diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-07 14:52:53 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-07 14:55:03 +0300 |
commit | 331f8500569df9b3b2aa776c5bcaad7b99c57295 (patch) | |
tree | 93547846177ff3415f9564ca54cb8f13433755cf /source/blender | |
parent | 11abeae99fdbfc8f047c4a3c1d2b9b8c47883516 (diff) |
Cleanup: redundant parenthesis
Diffstat (limited to 'source/blender')
253 files changed, 597 insertions, 614 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 57c1e280e8d..a673f4a1bc7 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -98,7 +98,7 @@ static int blf_search(const char *name) { for (int i = 0; i < BLF_MAX_FONT; i++) { const FontBLF *font = global_font[i]; - if (font && (STREQ(font->name, name))) { + if (font && STREQ(font->name, name)) { return i; } } @@ -226,7 +226,7 @@ void BLF_unload(const char *name) for (int i = 0; i < BLF_MAX_FONT; i++) { FontBLF *font = global_font[i]; - if (font && (STREQ(font->name, name))) { + if (font && STREQ(font->name, name)) { BLI_assert(font->reference_count > 0); font->reference_count--; diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 4704199c8a1..b60ca3da1ea 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -54,7 +54,7 @@ */ static FT_Fixed to_16dot16(double val) { - return (FT_Fixed)(lround(val * 65536.0)); + return (FT_Fixed)lround(val * 65536.0); } /** \} */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 85ce647fcab..928626ecc7b 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -3198,7 +3198,7 @@ static void animsys_create_action_track_strip(const AnimData *adt, * (which making new strips doesn't do due to the troublesome nature of that). */ calc_action_range(r_action_strip->act, &r_action_strip->actstart, &r_action_strip->actend, 1); r_action_strip->start = r_action_strip->actstart; - r_action_strip->end = (IS_EQF(r_action_strip->actstart, r_action_strip->actend)) ? + r_action_strip->end = IS_EQF(r_action_strip->actstart, r_action_strip->actend) ? (r_action_strip->actstart + 1.0f) : (r_action_strip->actend); diff --git a/source/blender/blenkernel/intern/blender_user_menu.c b/source/blender/blenkernel/intern/blender_user_menu.c index 86dd31576dd..9db8df52487 100644 --- a/source/blender/blenkernel/intern/blender_user_menu.c +++ b/source/blender/blenkernel/intern/blender_user_menu.c @@ -25,7 +25,7 @@ bUserMenu *BKE_blender_user_menu_find(ListBase *lb, char space_type, const char *context) { LISTBASE_FOREACH (bUserMenu *, um, lb) { - if ((space_type == um->space_type) && (STREQ(context, um->context))) { + if ((space_type == um->space_type) && STREQ(context, um->context)) { return um; } } diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index e404c982d55..8608ce97397 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -713,10 +713,8 @@ static bool camera_frame_fit_calc_from_data(CameraParams *params, plane_from_point_normal_v3(plane_tx[i], co, data->plane_tx[i]); } - if ((!isect_plane_plane_v3( - plane_tx[Y_MIN], plane_tx[Y_MAX], plane_isect_1, plane_isect_1_no)) || - (!isect_plane_plane_v3( - plane_tx[Z_MIN], plane_tx[Z_MAX], plane_isect_2, plane_isect_2_no))) { + if (!isect_plane_plane_v3(plane_tx[Y_MIN], plane_tx[Y_MAX], plane_isect_1, plane_isect_1_no) || + !isect_plane_plane_v3(plane_tx[Z_MIN], plane_tx[Z_MAX], plane_isect_2, plane_isect_2_no)) { return false; } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 08c36177600..56de583e2db 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1130,7 +1130,7 @@ static void cloth_update_springs(ClothModifierData *clmd) * because implicit solver would need reset! */ /* Activate / Deactivate existing springs */ - if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) && + if (!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED) && (cloth->verts[spring->ij].goal > ALMOST_ZERO)) { spring->flags &= ~CLOTH_SPRING_FLAG_DEACTIVATE; } diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 82b358b77a1..751b5185e39 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -946,7 +946,7 @@ bool BKE_collection_has_object(Collection *collection, const Object *ob) return false; } - return (BLI_findptr(&collection->gobject, ob, offsetof(CollectionObject, ob))); + return BLI_findptr(&collection->gobject, ob, offsetof(CollectionObject, ob)); } bool BKE_collection_has_object_recursive(Collection *collection, Object *ob) @@ -956,7 +956,7 @@ bool BKE_collection_has_object_recursive(Collection *collection, Object *ob) } const ListBase objects = BKE_collection_object_cache_get(collection); - return (BLI_findptr(&objects, ob, offsetof(Base, object))); + return BLI_findptr(&objects, ob, offsetof(Base, object)); } bool BKE_collection_has_object_recursive_instanced(Collection *collection, Object *ob) @@ -966,7 +966,7 @@ bool BKE_collection_has_object_recursive_instanced(Collection *collection, Objec } const ListBase objects = BKE_collection_object_cache_instanced_get(collection); - return (BLI_findptr(&objects, ob, offsetof(Base, object))); + return BLI_findptr(&objects, ob, offsetof(Base, object)); } static Collection *collection_next_find(Main *bmain, Scene *scene, Collection *collection) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index cc379ebb561..837eb892056 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1629,7 +1629,7 @@ void BKE_scopes_update(Scopes *scopes, } /* hmmmm */ - if (!(ELEM(ibuf->channels, 3, 4))) { + if (!ELEM(ibuf->channels, 3, 4)) { return; } diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index ceb84d213c3..d7bd0038d3c 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -634,7 +634,7 @@ ListBase CTX_data_dir_get(const bContext *C) bool CTX_data_equals(const char *member, const char *str) { - return (STREQ(member, str)); + return STREQ(member, str); } bool CTX_data_dir(const char *member) diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc index 5ba56946d8d..7c2e45d2f84 100644 --- a/source/blender/blenkernel/intern/cryptomatte.cc +++ b/source/blender/blenkernel/intern/cryptomatte.cc @@ -464,7 +464,7 @@ static std::string to_manifest(const CryptomatteLayer *layer) else { manifest << ","; } - manifest << quoted(item.key) << ":\"" << (item.value.hex_encoded()) << "\""; + manifest << quoted(item.key) << ":\"" << item.value.hex_encoded() << "\""; } manifest << "}"; return manifest.str(); diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc index 86db46e6161..28961461819 100644 --- a/source/blender/blenkernel/intern/curve.cc +++ b/source/blender/blenkernel/intern/curve.cc @@ -1935,7 +1935,7 @@ static void calc_bevel_sin_cos( t02 = M_PI_2; } else { - t02 = (saacos(t02)) / 2.0f; + t02 = saacos(t02) / 2.0f; } t02 = sinf(t02); @@ -4085,12 +4085,12 @@ void BKE_nurb_bezt_handle_test(BezTriple *bezt, } if (bezt->h1 == HD_VECT) { - if ((!(flag & SEL_F1)) != (!(flag & SEL_F2))) { + if (!(flag & SEL_F1) != !(flag & SEL_F2)) { bezt->h1 = HD_FREE; } } if (bezt->h2 == HD_VECT) { - if ((!(flag & SEL_F3)) != (!(flag & SEL_F2))) { + if (!(flag & SEL_F3) != !(flag & SEL_F2)) { bezt->h2 = HD_FREE; } } @@ -5101,7 +5101,7 @@ bool BKE_curve_minmax(Curve *cu, bool use_radius, float min[3], float max[3]) { ListBase *nurb_lb = BKE_curve_nurbs_get(cu); ListBase temp_nurb_lb = {nullptr, nullptr}; - const bool is_font = (BLI_listbase_is_empty(nurb_lb)) && (cu->len != 0); + const bool is_font = BLI_listbase_is_empty(nurb_lb) && (cu->len != 0); /* For font curves we generate temp list of splines. * * This is likely to be fine, this function is not supposed to be called diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c index fb082fccc0b..9a27ba91c2f 100644 --- a/source/blender/blenkernel/intern/curve_deform.c +++ b/source/blender/blenkernel/intern/curve_deform.c @@ -160,7 +160,7 @@ static bool calc_curve_deform( /* Zero the axis which is not used, * the big block of text above now applies to these 3 lines. * The `upflag` argument may be a dummy, set so no rotation is done. */ - quat_apply_track(quat, axis, (ELEM(axis, 0, 2)) ? 1 : 0); + quat_apply_track(quat, axis, ELEM(axis, 0, 2) ? 1 : 0); vec_apply_track(cent, axis); cent[index] = 0.0f; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 03358f50d40..e177250ae5a 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -121,7 +121,7 @@ BLI_INLINE void value_dissolve(float *r_value, const float scale, const bool is_log) { - *r_value = (is_log) ? (*r_value) * (powf(MIN_WETNESS, 1.0f / (1.2f * time / scale))) : + *r_value = (is_log) ? (*r_value) * powf(MIN_WETNESS, 1.0f / (1.2f * time / scale)) : (*r_value) - 1.0f / time * scale; } diff --git a/source/blender/blenkernel/intern/editmesh.cc b/source/blender/blenkernel/intern/editmesh.cc index fb4cfad0fb9..3a1dcd59f55 100644 --- a/source/blender/blenkernel/intern/editmesh.cc +++ b/source/blender/blenkernel/intern/editmesh.cc @@ -193,7 +193,7 @@ static void cage_mapped_verts_callback(void *userData, { CageUserData *data = static_cast<CageUserData *>(userData); - if ((index >= 0 && index < data->totvert) && (!BLI_BITMAP_TEST(data->visit_bitmap, index))) { + if ((index >= 0 && index < data->totvert) && !BLI_BITMAP_TEST(data->visit_bitmap, index)) { BLI_BITMAP_ENABLE(data->visit_bitmap, index); copy_v3_v3(data->cos_cage[index], co); } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 6719590e7c0..42b38854248 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -79,7 +79,7 @@ PartDeflect *BKE_partdeflect_new(int type) pd->pdef_sbift = 0.2f; pd->pdef_sboft = 0.02f; pd->pdef_cfrict = 5.0f; - pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; + pd->seed = ((uint)ceil(PIL_check_seconds_timer()) + 1) % 128; pd->f_strength = 1.0f; pd->f_damp = 1.0f; diff --git a/source/blender/blenkernel/intern/fcurve_driver.c b/source/blender/blenkernel/intern/fcurve_driver.c index aa33bef998f..9f63e2d3743 100644 --- a/source/blender/blenkernel/intern/fcurve_driver.c +++ b/source/blender/blenkernel/intern/fcurve_driver.c @@ -333,7 +333,7 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar) invert_qt_normalized(q1); mul_qt_qtqt(quat, q1, q2); - angle = 2.0f * (saacos(quat[0])); + angle = 2.0f * saacos(quat[0]); angle = fabsf(angle); return (angle > (float)M_PI) ? (float)((2.0f * (float)M_PI) - angle) : (float)(angle); diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 349614b93dd..0a39207184a 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -2204,9 +2204,9 @@ static void adaptive_domain_adjust( /* add to total shift */ add_v3_v3(fds->shift_f, frame_shift_f); /* convert to integer */ - total_shift[0] = (int)(floorf(fds->shift_f[0])); - total_shift[1] = (int)(floorf(fds->shift_f[1])); - total_shift[2] = (int)(floorf(fds->shift_f[2])); + total_shift[0] = (int)floorf(fds->shift_f[0]); + total_shift[1] = (int)floorf(fds->shift_f[1]); + total_shift[2] = (int)floorf(fds->shift_f[2]); int temp_shift[3]; copy_v3_v3_int(temp_shift, fds->shift); sub_v3_v3v3_int(new_shift, total_shift, fds->shift); diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index bfffd44e73d..45e56717d6a 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -83,8 +83,8 @@ static void greasepencil_copy_data(Main *UNUSED(bmain), /* Apply local layer transform to all frames. Calc the active frame is not enough * because onion skin can use more frames. This is more slow but required here. */ if (gpl_dst->actframe != NULL) { - bool transformed = ((!is_zero_v3(gpl_dst->location)) || (!is_zero_v3(gpl_dst->rotation)) || - (!is_one_v3(gpl_dst->scale))); + bool transformed = (!is_zero_v3(gpl_dst->location) || !is_zero_v3(gpl_dst->rotation) || + !is_one_v3(gpl_dst->scale)); if (transformed) { loc_eul_size_to_mat4( gpl_dst->layer_mat, gpl_dst->location, gpl_dst->rotation, gpl_dst->scale); @@ -2013,7 +2013,7 @@ bool BKE_gpencil_merge_materials_table_get(Object *ob, /* Read secondary material to compare with primary material. */ ma_secondary = BKE_gpencil_material(ob, idx_secondary + 1); if ((ma_secondary == NULL) || - (BLI_ghash_haskey(r_mat_table, POINTER_FROM_INT(idx_secondary)))) { + BLI_ghash_haskey(r_mat_table, POINTER_FROM_INT(idx_secondary))) { continue; } gp_style_primary = ma_primary->gp_style; @@ -2063,17 +2063,17 @@ bool BKE_gpencil_merge_materials_table_get(Object *ob, rgb_to_hsv_compat_v(col, f_hsv_b); /* Check stroke and fill color. */ - if ((!compare_ff(s_hsv_a[0], s_hsv_b[0], hue_threshold)) || - (!compare_ff(s_hsv_a[1], s_hsv_b[1], sat_threshold)) || - (!compare_ff(s_hsv_a[2], s_hsv_b[2], val_threshold)) || - (!compare_ff(f_hsv_a[0], f_hsv_b[0], hue_threshold)) || - (!compare_ff(f_hsv_a[1], f_hsv_b[1], sat_threshold)) || - (!compare_ff(f_hsv_a[2], f_hsv_b[2], val_threshold)) || - (!compare_ff(gp_style_primary->stroke_rgba[3], - gp_style_secondary->stroke_rgba[3], - val_threshold)) || - (!compare_ff( - gp_style_primary->fill_rgba[3], gp_style_secondary->fill_rgba[3], val_threshold))) { + if (!compare_ff(s_hsv_a[0], s_hsv_b[0], hue_threshold) || + !compare_ff(s_hsv_a[1], s_hsv_b[1], sat_threshold) || + !compare_ff(s_hsv_a[2], s_hsv_b[2], val_threshold) || + !compare_ff(f_hsv_a[0], f_hsv_b[0], hue_threshold) || + !compare_ff(f_hsv_a[1], f_hsv_b[1], sat_threshold) || + !compare_ff(f_hsv_a[2], f_hsv_b[2], val_threshold) || + !compare_ff(gp_style_primary->stroke_rgba[3], + gp_style_secondary->stroke_rgba[3], + val_threshold) || + !compare_ff( + gp_style_primary->fill_rgba[3], gp_style_secondary->fill_rgba[3], val_threshold)) { continue; } @@ -2337,7 +2337,7 @@ bool BKE_gpencil_from_image( static bool gpencil_is_layer_mask(ViewLayer *view_layer, bGPdata *gpd, bGPDlayer *gpl_mask) { LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { - if ((gpl->viewlayername[0] != '\0') && (!STREQ(view_layer->name, gpl->viewlayername))) { + if ((gpl->viewlayername[0] != '\0') && !STREQ(view_layer->name, gpl->viewlayername)) { continue; } @@ -2412,7 +2412,7 @@ void BKE_gpencil_visible_stroke_advanced_iter(ViewLayer *view_layer, int cfra) { bGPdata *gpd = (bGPdata *)ob->data; - const bool is_multiedit = (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd) && (!GPENCIL_PLAY_ON(gpd))); + const bool is_multiedit = (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd) && !GPENCIL_PLAY_ON(gpd)); const bool is_onion = do_onion && ((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0); const bool is_drawing = (gpd->runtime.sbuffer_used > 0); @@ -2444,7 +2444,7 @@ void BKE_gpencil_visible_stroke_advanced_iter(ViewLayer *view_layer, * generate renders, putting only selected GP layers for each View Layer. * This is used only in final render and never in Viewport. */ if ((view_layer != NULL) && (gpl->viewlayername[0] != '\0') && - (!STREQ(view_layer->name, gpl->viewlayername))) { + !STREQ(view_layer->name, gpl->viewlayername)) { /* Do not skip masks when rendering the view-layer so that it can still be used to clip * other layers. Instead set their opacity to zero. */ if (gpencil_is_layer_mask(view_layer, gpd, gpl)) { @@ -2786,8 +2786,8 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob) } /* Calc local layer transform. Early out if we have non-animated zero transforms. */ - bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || - (!is_one_v3(gpl->scale))); + bool transformed = (!is_zero_v3(gpl->location) || !is_zero_v3(gpl->rotation) || + !is_one_v3(gpl->scale)); float tmp_mat[4][4]; loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale); transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat); @@ -2834,7 +2834,7 @@ int BKE_gpencil_material_find_index_by_name_prefix(Object *ob, const char *name_ for (int i = 0; i < ob->totcol; i++) { Material *ma = BKE_object_material_get(ob, i + 1); if ((ma != NULL) && (ma->gp_style != NULL) && - (STREQLEN(ma->id.name + 2, name_prefix, name_prefix_len))) { + STREQLEN(ma->id.name + 2, name_prefix, name_prefix_len)) { return i; } } diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 191231f2b43..c84ee2e4a56 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -722,8 +722,8 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o } /* Only do layer transformations for non-zero or animated transforms. */ - bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || - (!is_one_v3(gpl->scale))); + bool transformed = (!is_zero_v3(gpl->location) || !is_zero_v3(gpl->rotation) || + !is_one_v3(gpl->scale)); float tmp_mat[4][4]; loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale); transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat); @@ -752,7 +752,7 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_orig); const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) && (ob_orig->greasepencil_modifiers.first != NULL) && - (!GPENCIL_SIMPLIFY_MODIF(scene))); + !GPENCIL_SIMPLIFY_MODIF(scene)); if ((!do_modifiers) && (!do_parent) && (!do_transform)) { BLI_assert(ob->data != NULL); return; @@ -782,7 +782,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) const bool is_multiedit = (bool)(GPENCIL_MULTIEDIT_SESSIONS_ON(gpd) && !is_render); const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) && (ob->greasepencil_modifiers.first != NULL) && - (!GPENCIL_SIMPLIFY_MODIF(scene))); + !GPENCIL_SIMPLIFY_MODIF(scene)); if (!do_modifiers) { return; } diff --git a/source/blender/blenkernel/intern/image_format.cc b/source/blender/blenkernel/intern/image_format.cc index 8bff6c376b3..8d1aeac76fb 100644 --- a/source/blender/blenkernel/intern/image_format.cc +++ b/source/blender/blenkernel/intern/image_format.cc @@ -520,7 +520,7 @@ static bool do_add_image_extension(char *string, } #endif else { // R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90 etc - if (!(BLI_path_extension_check_n(string, extension_test = ".jpg", ".jpeg", nullptr))) { + if (!BLI_path_extension_check_n(string, extension_test = ".jpg", ".jpeg", nullptr)) { extension = extension_test; } } diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc index f145f5db624..e227f9cba5e 100644 --- a/source/blender/blenkernel/intern/image_save.cc +++ b/source/blender/blenkernel/intern/image_save.cc @@ -824,7 +824,7 @@ bool BKE_image_render_write_exr(ReportList *reports, /* We only store RGBA passes as half float, for * others precision loss can be problematic. */ - const bool pass_RGBA = (STR_ELEM(rp->chan_id, "RGB", "RGBA", "R", "G", "B", "A")); + const bool pass_RGBA = STR_ELEM(rp->chan_id, "RGB", "RGBA", "R", "G", "B", "A"); const bool pass_half_float = half_float && pass_RGBA; /* Color-space conversion only happens on RGBA passes. */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 6a8edde9c49..bd655caae2b 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1542,7 +1542,7 @@ static void icu_to_fcurves(ID *id, } /* correct values, by checking if the flag of interest is set */ - if (((int)(dst->vec[1][1])) & (abp->bit)) { + if ((int)(dst->vec[1][1]) & (abp->bit)) { dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 1.0f; } else { diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index b9ea3eaba69..55834d5cf4e 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1282,8 +1282,8 @@ BLI_INLINE uint layer_bucket_index_from_xy(MaskRasterLayer *layer, const float x { BLI_assert(BLI_rctf_isect_pt_v(&layer->bounds, xy)); - return ((uint)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) + - (((uint)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x); + return (uint)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0]) + + ((uint)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1]) * layer->buckets_x); } static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2]) diff --git a/source/blender/blenkernel/intern/mball.cc b/source/blender/blenkernel/intern/mball.cc index d9b08d4fe2d..6b1394f65ab 100644 --- a/source/blender/blenkernel/intern/mball.cc +++ b/source/blender/blenkernel/intern/mball.cc @@ -297,7 +297,7 @@ bool BKE_mball_is_basis(const Object *ob) /* Just a quick test. */ const int len = strlen(ob->id.name); - return (!isdigit(ob->id.name[len - 1])); + return !isdigit(ob->id.name[len - 1]); } bool BKE_mball_is_same_group(const Object *ob1, const Object *ob2) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index c0315dcc848..fd3580a7e88 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -431,8 +431,7 @@ NlaStrip *BKE_nlastrip_new(bAction *act) BKE_action_get_frame_range(strip->act, &strip->actstart, &strip->actend); strip->start = strip->actstart; - strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f) : - (strip->actend); + strip->end = IS_EQF(strip->actstart, strip->actend) ? (strip->actstart + 1.0f) : strip->actend; /* strip should be referenced as-is */ strip->scale = 1.0f; diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 75da9f92f49..9417d1afc7e 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -3352,7 +3352,7 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float r_parentmat[4][ case PAROBJECT: { bool ok = false; if (par->type == OB_CURVES_LEGACY) { - if ((((Curve *)par->data)->flag & CU_PATH) && (ob_parcurve(ob, par, tmat))) { + if ((((Curve *)par->data)->flag & CU_PATH) && ob_parcurve(ob, par, tmat)) { ok = true; } } diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index c142f096395..396c3443a73 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -55,8 +55,8 @@ static float gaussRand(RNG *rng) float length2; do { - x = (float)(nextfr(rng, -1, 1)); - y = (float)(nextfr(rng, -1, 1)); + x = (float)nextfr(rng, -1, 1); + y = (float)nextfr(rng, -1, 1); length2 = x * x + y * y; } while (length2 >= 1 || length2 == 0); @@ -930,40 +930,37 @@ bool BKE_ocean_init(struct Ocean *o, case MOD_OCEAN_SPECTRUM_JONSWAP: mul_complex_f(o->_h0[i * o->_N + j], r1r2, - (float)(sqrt(BLI_ocean_spectrum_jonswap(o, o->_kx[i], o->_kz[j]) / 2.0f))); - mul_complex_f( - o->_h0_minus[i * o->_N + j], - r1r2, - (float)(sqrt(BLI_ocean_spectrum_jonswap(o, -o->_kx[i], -o->_kz[j]) / 2.0f))); + (float)sqrt(BLI_ocean_spectrum_jonswap(o, o->_kx[i], o->_kz[j]) / 2.0f)); + mul_complex_f(o->_h0_minus[i * o->_N + j], + r1r2, + (float)sqrt(BLI_ocean_spectrum_jonswap(o, -o->_kx[i], -o->_kz[j]) / 2.0f)); break; case MOD_OCEAN_SPECTRUM_TEXEL_MARSEN_ARSLOE: mul_complex_f( o->_h0[i * o->_N + j], r1r2, - (float)(sqrt(BLI_ocean_spectrum_texelmarsenarsloe(o, o->_kx[i], o->_kz[j]) / 2.0f))); + (float)sqrt(BLI_ocean_spectrum_texelmarsenarsloe(o, o->_kx[i], o->_kz[j]) / 2.0f)); mul_complex_f( o->_h0_minus[i * o->_N + j], r1r2, - (float)(sqrt(BLI_ocean_spectrum_texelmarsenarsloe(o, -o->_kx[i], -o->_kz[j]) / - 2.0f))); + (float)sqrt(BLI_ocean_spectrum_texelmarsenarsloe(o, -o->_kx[i], -o->_kz[j]) / 2.0f)); break; case MOD_OCEAN_SPECTRUM_PIERSON_MOSKOWITZ: mul_complex_f( o->_h0[i * o->_N + j], r1r2, - (float)(sqrt(BLI_ocean_spectrum_piersonmoskowitz(o, o->_kx[i], o->_kz[j]) / 2.0f))); + (float)sqrt(BLI_ocean_spectrum_piersonmoskowitz(o, o->_kx[i], o->_kz[j]) / 2.0f)); mul_complex_f( o->_h0_minus[i * o->_N + j], r1r2, - (float)(sqrt(BLI_ocean_spectrum_piersonmoskowitz(o, -o->_kx[i], -o->_kz[j]) / - 2.0f))); + (float)sqrt(BLI_ocean_spectrum_piersonmoskowitz(o, -o->_kx[i], -o->_kz[j]) / 2.0f)); break; default: mul_complex_f( - o->_h0[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); + o->_h0[i * o->_N + j], r1r2, (float)sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f)); mul_complex_f(o->_h0_minus[i * o->_N + j], r1r2, - (float)(sqrt(Ph(o, -o->_kx[i], -o->_kz[j]) / 2.0f))); + (float)sqrt(Ph(o, -o->_kx[i], -o->_kz[j]) / 2.0f)); break; } } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 3675dea50e3..6d42d344b86 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2463,7 +2463,7 @@ bool do_guides(Depsgraph *depsgraph, if (guidetime != 0.0f) { /* curve direction */ cross_v3_v3v3(temp, eff->guide_dir, guidedir); - angle = dot_v3v3(eff->guide_dir, guidedir) / (len_v3(eff->guide_dir)); + angle = dot_v3v3(eff->guide_dir, guidedir) / len_v3(eff->guide_dir); angle = saacos(angle); axis_angle_to_quat(rot2, temp, angle); mul_qt_v3(rot2, vec_to_point); @@ -2988,8 +2988,7 @@ static void psys_thread_create_path(ParticleTask *task, * pa->num, pa->fuv, * NULL); */ - cpa_num = (ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? pa->num : - pa->num_dmcache; + cpa_num = ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND) ? pa->num : pa->num_dmcache; /* XXX hack to avoid messed up particle num and subsequent crash (T40733) */ if (cpa_num > ctx->sim.psmd->mesh_final->totface) { @@ -3850,7 +3849,7 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4] MFace *mface; const float(*orcodata)[3]; - int i = (ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? pa->num : pa->num_dmcache; + int i = ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND) ? pa->num : pa->num_dmcache; if (i == -1 || i >= mesh->totface) { unit_m4(mat); return; diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index ce9fec6043d..4c56a8a9275 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -1093,7 +1093,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, maxweight /= totarea; } else { - float min = 1.0f / (float)(MIN2(totelem, totpart)); + float min = 1.0f / (float)MIN2(totelem, totpart); for (i = 0; i < totelem; i++) { element_weight[i] = min; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9608676a153..dec874caff4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -603,7 +603,7 @@ static void initialize_all_particles(ParticleSimulationData *sim) * UNEXIST flag. */ const bool emit_from_volume_grid = (part->distr == PART_DISTR_GRID) && - (!ELEM(part->from, PART_FROM_VERT, PART_FROM_CHILD)); + !ELEM(part->from, PART_FROM_VERT, PART_FROM_CHILD); PARTICLE_P; LOOP_PARTICLES { @@ -4150,17 +4150,17 @@ static bool particles_has_tracer(short parttype) static bool particles_has_spray(short parttype) { - return (ELEM(parttype, PART_FLUID_SPRAY, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE)); + return ELEM(parttype, PART_FLUID_SPRAY, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE); } static bool particles_has_bubble(short parttype) { - return (ELEM(parttype, PART_FLUID_BUBBLE, PART_FLUID_FOAMBUBBLE, PART_FLUID_SPRAYFOAMBUBBLE)); + return ELEM(parttype, PART_FLUID_BUBBLE, PART_FLUID_FOAMBUBBLE, PART_FLUID_SPRAYFOAMBUBBLE); } static bool particles_has_foam(short parttype) { - return (ELEM(parttype, PART_FLUID_FOAM, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE)); + return ELEM(parttype, PART_FLUID_FOAM, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE); } static void particles_fluid_step(ParticleSimulationData *sim, diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 9610443ef70..daad983f0bf 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -217,8 +217,8 @@ static void studiolight_load_solid_light(StudioLight *sl) #undef READ_IVAL #undef READ_FVAL -#define WRITE_FVAL(str, id, val) (BLI_dynstr_appendf(str, id " %f\n", val)) -#define WRITE_IVAL(str, id, val) (BLI_dynstr_appendf(str, id " %d\n", val)) +#define WRITE_FVAL(str, id, val) BLI_dynstr_appendf(str, id " %f\n", val) +#define WRITE_IVAL(str, id, val) BLI_dynstr_appendf(str, id " %d\n", val) #define WRITE_VEC3(str, id, val) \ do { \ @@ -273,7 +273,7 @@ static void direction_to_equirect(float r[2], const float dir[3]) static void equirect_to_direction(float r[3], float u, float v) { - float phi = (-(M_PI * 2)) * u + M_PI; + float phi = -(M_PI * 2) * u + M_PI; float theta = -M_PI * v + M_PI; float sin_theta = sinf(theta); r[0] = sin_theta * cosf(phi); diff --git a/source/blender/blenkernel/intern/subdiv_ccg.cc b/source/blender/blenkernel/intern/subdiv_ccg.cc index f84f15c749b..6f583f760ef 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.cc +++ b/source/blender/blenkernel/intern/subdiv_ccg.cc @@ -128,8 +128,8 @@ static void subdiv_ccg_alloc_elements(SubdivCCG *subdiv_ccg, Subdiv *subdiv) subdiv_ccg->num_grids = num_grids; subdiv_ccg->grids = static_cast<CCGElem **>( MEM_calloc_arrayN(num_grids, sizeof(CCGElem *), "subdiv ccg grids")); - subdiv_ccg->grids_storage = static_cast<unsigned char *>(MEM_calloc_arrayN( - num_grids, (size_t(grid_area)) * element_size, "subdiv ccg grids storage")); + subdiv_ccg->grids_storage = static_cast<unsigned char *>( + MEM_calloc_arrayN(num_grids, size_t(grid_area) * element_size, "subdiv ccg grids storage")); const size_t grid_size_in_bytes = size_t(grid_area) * element_size; for (int grid_index = 0; grid_index < num_grids; grid_index++) { const size_t grid_offset = grid_size_in_bytes * grid_index; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index c6efe235172..3748c6a053c 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2660,9 +2660,9 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, if (from_anchor) { for (int a = 0; a < 5; a++) { src_pixel_x[a] += (double)((track->offset[0] * frame_width) - - ((int)(track->offset[0] * frame_width))); + (int)(track->offset[0] * frame_width)); src_pixel_y[a] += (double)((track->offset[1] * frame_height) - - ((int)(track->offset[1] * frame_height))); + (int)(track->offset[1] * frame_height)); /* when offset is negative, rounding happens in opposite direction */ if (track->offset[0] < 0.0f) { diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index 0e04da246fc..7ace1a3aa3b 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -1044,7 +1044,7 @@ static bool vfont_to_curve(Object *ob, CLAMP_MIN(maxlen, lineinfo[lnr].x_min); - if ((tb_scale.h != 0.0f) && ((-(yof - tb_scale.y)) > (tb_scale.h - linedist) - yof_scale)) { + if ((tb_scale.h != 0.0f) && (-(yof - tb_scale.y) > (tb_scale.h - linedist) - yof_scale)) { if (cu->totbox > (curbox + 1)) { maxlen = 0; curbox++; @@ -1175,7 +1175,7 @@ static bool vfont_to_curve(Object *ob, } } for (i = 0; i <= slen; i++) { - for (j = i; (!ELEM(mem[j], '\0', '\n')) && (chartransdata[j].dobreak == 0) && (j < slen); + for (j = i; !ELEM(mem[j], '\0', '\n') && (chartransdata[j].dobreak == 0) && (j < slen); j++) { /* do nothing */ } diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 3c745716ec8..ceb7f7f0aba 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -80,7 +80,7 @@ static bool keycmp(const void *a, const void *b) if (ka->case_str == 1 || kb->case_str == 1) { return (BLI_strcasecmp(ka->arg, kb->arg) != 0); } - return (!STREQ(ka->arg, kb->arg)); + return !STREQ(ka->arg, kb->arg); } return BLI_ghashutil_intcmp((const void *)ka->pass, (const void *)kb->pass); } diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 4e532f90fb5..1ce6beab933 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -93,7 +93,7 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2) return 1; } - return (BLI_strcasecmp_natural(entry1->relname, entry2->relname)); + return BLI_strcasecmp_natural(entry1->relname, entry2->relname); } struct BuildDirCtx { diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c index d55a4a8c9ff..309ae624305 100644 --- a/source/blender/blenlib/intern/boxpack_2d.c +++ b/source/blender/blenlib/intern/boxpack_2d.c @@ -491,7 +491,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r * flag verts on one or both of the boxes * as being used by checking the width or * height of both boxes */ - if (vert->tlb && vert->trb && (ELEM(box, vert->tlb, vert->trb))) { + if (vert->tlb && vert->trb && ELEM(box, vert->tlb, vert->trb)) { if (UNLIKELY(fabsf(vert->tlb->h - vert->trb->h) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->trb->v[TL]) @@ -522,7 +522,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r vert->tlb->v[TR]->free &= ~(TRF | BRF); } } - else if (vert->blb && vert->brb && (ELEM(box, vert->blb, vert->brb))) { + else if (vert->blb && vert->brb && ELEM(box, vert->blb, vert->brb)) { if (UNLIKELY(fabsf(vert->blb->h - vert->brb->h) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->blb->v[BR]) @@ -554,7 +554,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r } } /* Horizontal */ - if (vert->tlb && vert->blb && (ELEM(box, vert->tlb, vert->blb))) { + if (vert->tlb && vert->blb && ELEM(box, vert->tlb, vert->blb)) { if (UNLIKELY(fabsf(vert->tlb->w - vert->blb->w) < EPSILON_MERGE)) { #ifdef USE_MERGE # define A (vert->blb->v[TL]) @@ -585,7 +585,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r vert->tlb->v[BL]->free &= ~(BLF | BRF); } } - else if (vert->trb && vert->brb && (ELEM(box, vert->trb, vert->brb))) { + else if (vert->trb && vert->brb && ELEM(box, vert->trb, vert->brb)) { if (UNLIKELY(fabsf(vert->trb->w - vert->brb->w) < EPSILON_MERGE)) { #ifdef USE_MERGE diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 257153dc6fe..8a791030fce 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -65,7 +65,7 @@ float floor_power_of_10(float f) { BLI_assert(!(f < 0.0f)); if (f != 0.0f) { - return 1.0f / (powf(10.0f, ceilf(log10f(1.0f / f)))); + return 1.0f / powf(10.0f, ceilf(log10f(1.0f / f))); } return 0.0f; } @@ -74,7 +74,7 @@ float ceil_power_of_10(float f) { BLI_assert(!(f < 0.0f)); if (f != 0.0f) { - return 1.0f / (powf(10.0f, floorf(log10f(1.0f / f)))); + return 1.0f / powf(10.0f, floorf(log10f(1.0f / f))); } return 0.0f; } diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index e4b352dc22c..51860c1abdb 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -368,9 +368,9 @@ uint rgb_to_cpack(float r, float g, float b) void cpack_to_rgb(uint col, float *r_r, float *r_g, float *r_b) { - *r_r = ((float)(col & 0xFF)) * (1.0f / 255.0f); - *r_g = ((float)((col >> 8) & 0xFF)) * (1.0f / 255.0f); - *r_b = ((float)((col >> 16) & 0xFF)) * (1.0f / 255.0f); + *r_r = (float)(col & 0xFF) * (1.0f / 255.0f); + *r_g = (float)((col >> 8) & 0xFF) * (1.0f / 255.0f); + *r_b = (float)((col >> 16) & 0xFF) * (1.0f / 255.0f); } void rgb_uchar_to_float(float r_col[3], const uchar col_ub[3]) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 2a003100c7a..08152976f7d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2748,7 +2748,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e1, vel); edotbv = dot_v3v3(e1, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; @@ -2770,7 +2770,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e2, vel); edotbv = dot_v3v3(e2, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; @@ -2797,7 +2797,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], edotv = dot_v3v3(e3, vel); edotbv = dot_v3v3(e3, bv); - a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv; + a = elen2 * -dot_v3v3(vel, vel) + edotv * edotv; b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv); c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 4feb1d5ee56..29907924bd8 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -624,10 +624,10 @@ void BLI_ewa_filter(const int width, U0 = uv[0] * (float)width; V0 = uv[1] * (float)height; - u1 = (int)(floorf(U0 - ue)); - u2 = (int)(ceilf(U0 + ue)); - v1 = (int)(floorf(V0 - ve)); - v2 = (int)(ceilf(V0 + ve)); + u1 = (int)floorf(U0 - ue); + u2 = (int)ceilf(U0 + ue); + v1 = (int)floorf(V0 - ve); + v2 = (int)ceilf(V0 + ve); /* sane clamping to avoid unnecessarily huge loops */ /* NOTE: if eccentricity gets clamped (see above), diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 91b07639e9b..ff45bbee5c9 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -2360,8 +2360,8 @@ bool mat3_from_axis_conversion( value = ((src_forward << (0 * 3)) | (src_up << (1 * 3)) | (dst_forward << (2 * 3)) | (dst_up << (3 * 3))); - for (uint i = 0; i < (ARRAY_SIZE(_axis_convert_matrix)); i++) { - for (uint j = 0; j < (ARRAY_SIZE(*_axis_convert_lut)); j++) { + for (uint i = 0; i < ARRAY_SIZE(_axis_convert_matrix); i++) { + for (uint j = 0; j < ARRAY_SIZE(*_axis_convert_lut); j++) { if (_axis_convert_lut[i][j] == value) { copy_m3_m3(r_mat, _axis_convert_matrix[i]); return true; diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 5dcdabaf760..f65a5acceae 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -499,7 +499,7 @@ float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const f /* calculate the sign (reuse 'tproj') */ cross_v3_v3v3(tproj, v2_proj, v1_proj); if (dot_v3v3(tproj, axis) < 0.0f) { - angle = ((float)(M_PI * 2.0)) - angle; + angle = (float)(M_PI * 2.0) - angle; } return angle; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index b8c17ce20fa..8da35e5ab56 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -939,9 +939,9 @@ void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me break; } - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); da[0] = da[1] = da[2] = da[3] = 1e10f; for (int xx = xi - 1; xx <= xi + 1; xx++) { for (int yy = yi - 1; yy <= yi + 1; yy++) { @@ -1112,9 +1112,9 @@ static float BLI_cellNoiseU(float x, float y, float z) y = (y + 0.000001f) * 1.00001f; z = (z + 0.000001f) * 1.00001f; - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); uint n = xi + yi * 1301 + zi * 314159; n ^= (n << 13); return ((float)(n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f); @@ -1132,9 +1132,9 @@ void BLI_noise_cell_v3(float x, float y, float z, float r_ca[3]) y = (y + 0.000001f) * 1.00001f; z = (z + 0.000001f) * 1.00001f; - int xi = (int)(floor(x)); - int yi = (int)(floor(y)); - int zi = (int)(floor(z)); + int xi = (int)floor(x); + int yi = (int)floor(y); + int zi = (int)floor(z); const float *p = HASHPNT(xi, yi, zi); r_ca[0] = p[0]; r_ca[1] = p[1]; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index a3be9732a68..6ff4d57aecb 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1347,7 +1347,7 @@ bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ssize_t a; /* first check the extension is already there */ - if ((ext_len <= path_len) && (STREQ(path + (path_len - ext_len), ext))) { + if ((ext_len <= path_len) && STREQ(path + (path_len - ext_len), ext)) { return true; } diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index eed87eda436..2b59de5b569 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -373,12 +373,12 @@ static bool kdtree2d_isect_tri_recursive(const struct KDTree2D *tree, # define KDTREE2D_ISECT_TRI_RECURSE_NEG \ (((node->neg != KDNODE_UNSET) && (co[node->axis] >= bounds[node->axis].min)) && \ - (kdtree2d_isect_tri_recursive( \ - tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->neg]))) + kdtree2d_isect_tri_recursive( \ + tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->neg])) # define KDTREE2D_ISECT_TRI_RECURSE_POS \ (((node->pos != KDNODE_UNSET) && (co[node->axis] <= bounds[node->axis].max)) && \ - (kdtree2d_isect_tri_recursive( \ - tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->pos]))) + kdtree2d_isect_tri_recursive( \ + tree, tri_index, tri_coords, tri_center, bounds, &tree->nodes[node->pos])) if (tri_center[node->axis] > co[node->axis]) { if (KDTREE2D_ISECT_TRI_RECURSE_POS) { diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 38b6f015148..89d31c5e93f 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -314,7 +314,7 @@ size_t BLI_str_unescape_ex(char *__restrict dst, break; } char c = *src; - if (UNLIKELY(c == '\\') && (str_unescape_pair(*(src + 1), &c))) { + if (UNLIKELY(c == '\\') && str_unescape_pair(*(src + 1), &c)) { src++; } dst[len++] = c; @@ -329,7 +329,7 @@ size_t BLI_str_unescape(char *__restrict dst, const char *__restrict src, const size_t len = 0; for (const char *src_end = src + src_maxncpy; (src < src_end) && *src; src++) { char c = *src; - if (UNLIKELY(c == '\\') && (str_unescape_pair(*(src + 1), &c))) { + if (UNLIKELY(c == '\\') && str_unescape_pair(*(src + 1), &c)) { src++; } dst[len++] = c; diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c index fc78b0ad98d..ecaa469984d 100644 --- a/source/blender/blenlib/intern/timecode.c +++ b/source/blender/blenlib/intern/timecode.c @@ -176,7 +176,7 @@ size_t BLI_timecode_string_from_time_simple(char *str, const int hr = ((int)time_seconds) / (60 * 60); const int min = (((int)time_seconds) / 60) % 60; const int sec = ((int)time_seconds) % 60; - const int hun = ((int)(fmod(time_seconds, 1.0) * 100)); + const int hun = (int)(fmod(time_seconds, 1.0) * 100); if (hr) { rlen = BLI_snprintf_rlen(str, maxncpy, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun); diff --git a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc index 778f048a8e7..2ed1786f9e0 100644 --- a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc +++ b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc @@ -130,7 +130,7 @@ TEST(linear_allocator, ManyAllocations) RandomNumberGenerator rng; for (int i = 0; i < 1000; i++) { int size = rng.get_int32(10000); - int alignment = 1 << (rng.get_int32(7)); + int alignment = 1 << rng.get_int32(7); void *buffer = allocator.allocate(size, alignment); EXPECT_NE(buffer, nullptr); } diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc index dd954f6e3e9..ec1768232c8 100644 --- a/source/blender/blenloader/intern/readfile.cc +++ b/source/blender/blenloader/intern/readfile.cc @@ -1112,7 +1112,7 @@ static int *read_file_thumbnail(FileData *fd) const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0; int *data = (int *)(bhead + 1); - if (bhead->len < (sizeof(int[2]))) { + if (bhead->len < sizeof(int[2])) { break; } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a9048037513..061840aee7a 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -595,7 +595,7 @@ static void do_versions_fix_annotations(bGPdata *gpd) LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - if ((gps->colorname[0] != '\0') && (STREQ(gps->colorname, palcolor->info))) { + if ((gps->colorname[0] != '\0') && STREQ(gps->colorname, palcolor->info)) { /* copy color settings */ copy_v4_v4(gpl->color, palcolor->color); } diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index b285e1829b7..e4c476e1212 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1611,8 +1611,8 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if ((!MAIN_VERSION_ATLEAST(bmain, 292, 14)) || - ((bmain->versionfile == 293) && (!MAIN_VERSION_ATLEAST(bmain, 293, 1)))) { + if (!MAIN_VERSION_ATLEAST(bmain, 292, 14) || + ((bmain->versionfile == 293) && !MAIN_VERSION_ATLEAST(bmain, 293, 1))) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) { if (ntree->type != NTREE_GEOMETRY) { continue; diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 51063f47ef9..0a9d40e161a 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -1194,7 +1194,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 && - (ELEM(tex->feature, SHD_VORONOI_F1, SHD_VORONOI_F2)) && socket_is_used(sockDistance)) { + 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; multiplyNode->locx = node->locx + node->width + 20.0f; diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 94438acf4fa..9a0568a3589 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -2531,7 +2531,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Object *ob; for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->pd) { - ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; + ob->pd->seed = ((uint)ceil(PIL_check_seconds_timer()) + 1) % 128; } } } diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c index cd89a550279..6705ac5acca 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_normals.c +++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c @@ -1780,7 +1780,7 @@ void BM_lnorspace_invalidate(BMesh *bm, const bool do_invalidate_all) /* Note that we only handle unselected neighbor vertices here, main loop will take care of * selected ones. */ - if ((!BM_elem_flag_test(l->prev->v, BM_ELEM_SELECT)) && + if (!BM_elem_flag_test(l->prev->v, BM_ELEM_SELECT) && !BLI_BITMAP_TEST(done_verts, BM_elem_index_get(l->prev->v))) { BMLoop *l_prev; @@ -1791,7 +1791,7 @@ void BM_lnorspace_invalidate(BMesh *bm, const bool do_invalidate_all) BLI_BITMAP_ENABLE(done_verts, BM_elem_index_get(l_prev->v)); } - if ((!BM_elem_flag_test(l->next->v, BM_ELEM_SELECT)) && + if (!BM_elem_flag_test(l->next->v, BM_ELEM_SELECT) && !BLI_BITMAP_TEST(done_verts, BM_elem_index_get(l->next->v))) { BMLoop *l_next; diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.c b/source/blender/bmesh/intern/bmesh_mesh_partial_update.c index 757ca8f19b6..197af450f72 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.c +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.c @@ -52,7 +52,7 @@ #define GROW(len_alloc) ((len_alloc) + ((len_alloc) - ((len_alloc) / 2))) #define GROW_ARRAY(mem, len_alloc) \ { \ - mem = MEM_reallocN(mem, (sizeof(*mem)) * ((len_alloc) = GROW(len_alloc))); \ + mem = MEM_reallocN(mem, sizeof(*mem) * ((len_alloc) = GROW(len_alloc))); \ } \ ((void)0) diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 13619d8e235..a1842b598d5 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -62,7 +62,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) e = v->e; do { e = bmesh_disk_edge_next(e, v); - if (!(BM_edge_share_face_check(e, v->e))) { + if (!BM_edge_share_face_check(e, v->e)) { keepedge = e; baseedge = v->e; break; diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 1da0108bd6a..2a6b5459d1c 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -721,7 +721,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op) (use_boundary && BM_edge_is_boundary(e) && BM_elem_flag_test(e->l->f, BM_ELEM_TAG)) || /* tag if edge is an interior edge in between a tagged and untagged face */ - (bm_edge_is_mixed_face_tag(e->l))) { + bm_edge_is_mixed_face_tag(e->l)) { /* tag */ BM_elem_flag_enable(e->v1, BM_ELEM_TAG); BM_elem_flag_enable(e->v2, BM_ELEM_TAG); diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index ab74aa2e1bb..df749b591dc 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -43,11 +43,11 @@ static float quad_calc_error(const float v1[3], normal_tri_v3(n1, v1, v2, v3); normal_tri_v3(n2, v1, v3, v4); - angle_a = (compare_v3v3(n1, n2, FLT_EPSILON)) ? 0.0f : angle_normalized_v3v3(n1, n2); + angle_a = compare_v3v3(n1, n2, FLT_EPSILON) ? 0.0f : angle_normalized_v3v3(n1, n2); normal_tri_v3(n1, v2, v3, v4); normal_tri_v3(n2, v4, v1, v2); - angle_b = (compare_v3v3(n1, n2, FLT_EPSILON)) ? 0.0f : angle_normalized_v3v3(n1, n2); + angle_b = compare_v3v3(n1, n2, FLT_EPSILON) ? 0.0f : angle_normalized_v3v3(n1, n2); diff = (angle_a + angle_b) / (float)(M_PI * 2); @@ -166,15 +166,15 @@ static float bm_edge_is_delimit(const BMEdge *e, const struct DelimitData *delim float angle; #endif - if ((delimit_data->do_seam) && (BM_elem_flag_test(e, BM_ELEM_SEAM))) { + if (delimit_data->do_seam && BM_elem_flag_test(e, BM_ELEM_SEAM)) { goto fail; } - if ((delimit_data->do_sharp) && (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == 0)) { + if (delimit_data->do_sharp && (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == 0)) { goto fail; } - if ((delimit_data->do_mat) && (f_a->mat_nr != f_b->mat_nr)) { + if (delimit_data->do_mat && (f_a->mat_nr != f_b->mat_nr)) { goto fail; } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index a141a9a1dda..8da28af3ca7 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -4697,7 +4697,7 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe) * vertices to snap to the midline on the pipe, not just to one plane or the other. */ bool even = (ns % 2) == 0; bool midline = even && k == half_ns && - ((i == 0 && j == half_ns) || (ELEM(i, ipipe1, ipipe2))); + ((i == 0 && j == half_ns) || ELEM(i, ipipe1, ipipe2)); snap_to_pipe_profile(vpipe, midline, mesh_vert(vm, i, j, k)->co); } } @@ -5376,7 +5376,7 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv, BoundVert for (int i = 0; i < n_bndv; i++) { for (int j = 0; j <= ns2; j++) { for (int k = 0; k <= ns; k++) { - if (j == 0 && (ELEM(k, 0, ns))) { + if (j == 0 && ELEM(k, 0, ns)) { continue; /* Boundary corners already made. */ } if (!is_canon(vm, i, j, k)) { diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index 873b47a7080..444f45277ca 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -463,7 +463,7 @@ void BM_mesh_bisect_plane(BMesh *bm, } vert_is_center_disable(v); - BM_VERT_DIR(v) = plane_point_test_v3(plane, v->co, eps, &(BM_VERT_DIST(v))); + BM_VERT_DIR(v) = plane_point_test_v3(plane, v->co, eps, &BM_VERT_DIST(v)); if (BM_VERT_DIR(v) == 0) { if (oflag_center) { diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 62f472b5146..1ea799f64e0 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -618,9 +618,9 @@ static void bm_decim_triangulate_end(BMesh *bm, const int edges_tri_tot) (BM_loop_is_manifold(l) && ((l)->v != (l)->radial_next->v) && \ (l_a_index == BM_elem_index_get(l)) && (l_a_index == BM_elem_index_get((l)->radial_next))) - if ((l_a->f->len == 3 && l_b->f->len == 3) && (!CAN_LOOP_MERGE(l_a->next)) && - (!CAN_LOOP_MERGE(l_a->prev)) && (!CAN_LOOP_MERGE(l_b->next)) && - (!CAN_LOOP_MERGE(l_b->prev))) { + if ((l_a->f->len == 3 && l_b->f->len == 3) && !CAN_LOOP_MERGE(l_a->next) && + !CAN_LOOP_MERGE(l_a->prev) && !CAN_LOOP_MERGE(l_b->next) && + !CAN_LOOP_MERGE(l_b->prev)) { BMVert *vquad[4] = { e->v1, BM_vert_in_edge(e, l_a->next->v) ? l_a->prev->v : l_a->next->v, diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c b/source/blender/bmesh/tools/bmesh_edgenet.c index 110017739b9..020f2613f7d 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.c +++ b/source/blender/bmesh/tools/bmesh_edgenet.c @@ -37,7 +37,7 @@ enum { */ static bool bm_edge_step_ok(BMEdge *e) { - return BM_elem_flag_test(e, BM_ELEM_TAG) && (ELEM(e->l, NULL, e->l->radial_next)); + return BM_elem_flag_test(e, BM_ELEM_TAG) && ELEM(e->l, NULL, e->l->radial_next); } static int bm_edge_face(BMEdge *e) diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index dd2915e6616..a06efe8da96 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -1263,7 +1263,7 @@ bool BM_mesh_intersect(BMesh *bm, /* only start on an edge-case */ /* pass */ } - else if ((!BM_elem_flag_test(v_a, BM_ELEM_TAG)) && (!BM_elem_flag_test(v_b, BM_ELEM_TAG))) { + else if (!BM_elem_flag_test(v_a, BM_ELEM_TAG) && !BM_elem_flag_test(v_b, BM_ELEM_TAG)) { /* simple case, single edge spans face */ BMVert **splice_pair; BM_elem_flag_enable(e_pair[1], BM_ELEM_TAG); diff --git a/source/blender/bmesh/tools/bmesh_path.c b/source/blender/bmesh/tools/bmesh_path.c index 5f1003ad808..764ce323923 100644 --- a/source/blender/bmesh/tools/bmesh_path.c +++ b/source/blender/bmesh/tools/bmesh_path.c @@ -231,7 +231,7 @@ static void edgetag_add_adjacent(HeapSimple *heap, BM_ITER_ELEM (v, &viter, e_a, BM_VERTS_OF_EDGE) { /* Don't walk over previous vertex. */ - if ((edges_prev[e_a_index]) && (BM_vert_in_edge(edges_prev[e_a_index], v))) { + if ((edges_prev[e_a_index]) && BM_vert_in_edge(edges_prev[e_a_index], v)) { continue; } diff --git a/source/blender/bmesh/tools/bmesh_path_uv.c b/source/blender/bmesh/tools/bmesh_path_uv.c index 6531677fce6..ecc92fd09a4 100644 --- a/source/blender/bmesh/tools/bmesh_path_uv.c +++ b/source/blender/bmesh/tools/bmesh_path_uv.c @@ -354,7 +354,7 @@ struct LinkNode *BM_mesh_calc_path_uv_edge(BMesh *bm, while (!BLI_heapsimple_is_empty(heap)) { l = BLI_heapsimple_pop_min(heap); - if ((l->e == l_dst->e) && (BM_loop_uv_share_edge_check(l, l_dst, params->cd_loop_uv_offset))) { + if ((l->e == l_dst->e) && BM_loop_uv_share_edge_check(l, l_dst, params->cd_loop_uv_offset)) { break; } @@ -364,7 +364,7 @@ struct LinkNode *BM_mesh_calc_path_uv_edge(BMesh *bm, } } - if ((l->e == l_dst->e) && (BM_loop_uv_share_edge_check(l, l_dst, params->cd_loop_uv_offset))) { + if ((l->e == l_dst->e) && BM_loop_uv_share_edge_check(l, l_dst, params->cd_loop_uv_offset)) { do { BLI_linklist_prepend(&path, l); } while ((l = loops_prev[BM_elem_index_get(l)])); diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c index d693755053c..8e971aeddb0 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.c +++ b/source/blender/bmesh/tools/bmesh_region_match.c @@ -510,7 +510,7 @@ static void bm_uuidwalk_pass_add(UUIDWalk *uuidwalk, do { if (!BLI_ghash_haskey(uuidwalk->faces_uuid, l_iter_radial->f) && !BLI_gset_haskey(faces_step_next, l_iter_radial->f) && - (bm_uuidwalk_face_test(uuidwalk, l_iter_radial->f))) { + bm_uuidwalk_face_test(uuidwalk, l_iter_radial->f)) { BLI_gset_insert(faces_step_next, l_iter_radial->f); /* add to fstep */ diff --git a/source/blender/compositor/intern/COM_Node.cc b/source/blender/compositor/intern/COM_Node.cc index 471bb29d263..c1a8740d8ea 100644 --- a/source/blender/compositor/intern/COM_Node.cc +++ b/source/blender/compositor/intern/COM_Node.cc @@ -53,10 +53,10 @@ Node::Node(bNode *editor_node, bool create_sockets) Node::~Node() { while (!outputs_.is_empty()) { - delete (outputs_.pop_last()); + delete outputs_.pop_last(); } while (!inputs_.is_empty()) { - delete (inputs_.pop_last()); + delete inputs_.pop_last(); } } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 1fdec43eb3b..8212be5ec26 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -576,7 +576,7 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, /* try to find existing write buffer operation */ if (target->get_operation().get_flags().is_write_buffer_operation) { BLI_assert(write_operation == nullptr); /* there should only be one write op connected */ - write_operation = (WriteBufferOperation *)(&target->get_operation()); + write_operation = (WriteBufferOperation *)&target->get_operation(); } else { /* remove all links to other nodes */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index e5b03bd5291..b657d39df69 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -191,7 +191,7 @@ bool check_id_has_anim_component(ID *id) if (adt == nullptr) { return false; } - return (adt->action != nullptr) || (!BLI_listbase_is_empty(&adt->nla_tracks)); + return (adt->action != nullptr) || !BLI_listbase_is_empty(&adt->nla_tracks); } bool check_id_has_driver_component(ID *id) diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 5fa719facf4..0e1cc82797a 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -29,7 +29,7 @@ static struct { #define SETUP_BUFFER(tex, fb, fb_color) \ { \ - eGPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : GPU_RGBA16F; \ + eGPUTextureFormat format = DRW_state_is_scene_render() ? GPU_RGBA32F : GPU_RGBA16F; \ DRW_texture_ensure_fullscreen_2d(&tex, format, DRW_TEX_FILTER); \ GPU_framebuffer_ensure_config(&fb, \ { \ diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 2d96cffb4ba..05b2bafdb3a 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -158,7 +158,7 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) if (DRW_view_is_persp_get(NULL)) { float sample_distribution = scene_eval->eevee.volumetric_sample_distribution; - sample_distribution = 4.0f * (max_ff(1.0f - sample_distribution, 1e-2f)); + sample_distribution = 4.0f * max_ff(1.0f - sample_distribution, 1e-2f); const float clip_start = DRW_view_near_distance_get(NULL); /* Negate */ diff --git a/source/blender/draw/engines/eevee_next/eevee_motion_blur.cc b/source/blender/draw/engines/eevee_next/eevee_motion_blur.cc index f68abafa3d4..d6fc74730b2 100644 --- a/source/blender/draw/engines/eevee_next/eevee_motion_blur.cc +++ b/source/blender/draw/engines/eevee_next/eevee_motion_blur.cc @@ -141,8 +141,8 @@ void MotionBlurModule::sync() { /* Create max velocity tiles. */ PassSimple::Sub &sub = motion_blur_ps_.sub("TilesFlatten"); - eShaderType shader = (inst_.is_viewport()) ? MOTION_BLUR_TILE_FLATTEN_VIEWPORT : - MOTION_BLUR_TILE_FLATTEN_RENDER; + eShaderType shader = inst_.is_viewport() ? MOTION_BLUR_TILE_FLATTEN_VIEWPORT : + MOTION_BLUR_TILE_FLATTEN_RENDER; sub.shader_set(inst_.shaders.static_shader_get(shader)); sub.bind_ubo("motion_blur_buf", data_); sub.bind_texture("depth_tx", &render_buffers.depth_tx); diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc b/source/blender/draw/engines/overlay/overlay_extra.cc index 724ebd64e16..114123ab36e 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.cc +++ b/source/blender/draw/engines/overlay/overlay_extra.cc @@ -1552,7 +1552,7 @@ void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob) /* Don't show fluid domain overlay extras outside of cache range. */ const bool draw_volume = !from_dupli && (md = BKE_modifiers_findby_type(ob, eModifierType_Fluid)) && - (BKE_modifier_is_enabled(scene, md, eModifierMode_Realtime)) && + BKE_modifier_is_enabled(scene, md, eModifierMode_Realtime) && (((FluidModifierData *)md)->domain != nullptr) && (scene->r.cfra >= (((FluidModifierData *)md)->domain->cache_frame_start)) && diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index eec15a4668d..8c6a51442e1 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -2423,7 +2423,7 @@ static float x_axis_name[4][2] = { {-0.9f * S_X, 1.0f * S_Y}, {1.0f * S_X, -1.0f * S_Y}, }; -#define X_LEN (sizeof(x_axis_name) / (sizeof(float[2]))) +#define X_LEN (sizeof(x_axis_name) / sizeof(float[2])) #undef S_X #undef S_Y @@ -2437,7 +2437,7 @@ static float y_axis_name[6][2] = { {0.0f * S_X, -0.1f * S_Y}, {0.0f * S_X, -1.0f * S_Y}, }; -#define Y_LEN (sizeof(y_axis_name) / (sizeof(float[2]))) +#define Y_LEN (sizeof(y_axis_name) / sizeof(float[2])) #undef S_X #undef S_Y @@ -2455,7 +2455,7 @@ static float z_axis_name[10][2] = { {-1.00f * S_X, -1.00f * S_Y}, {1.00f * S_X, -1.00f * S_Y}, }; -#define Z_LEN (sizeof(z_axis_name) / (sizeof(float[2]))) +#define Z_LEN (sizeof(z_axis_name) / sizeof(float[2])) #undef S_X #undef S_Y @@ -2482,7 +2482,7 @@ static float axis_marker[8][2] = { {-S_X, 0.0f} #endif }; -#define MARKER_LEN (sizeof(axis_marker) / (sizeof(float[2]))) +#define MARKER_LEN (sizeof(axis_marker) / sizeof(float[2])) #define MARKER_FILL_LAYER 6 #undef S_X #undef S_Y diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index aecf4b2f004..7a43c7ee2e6 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -315,7 +315,7 @@ static void gpencil_buffer_add_point(gpStrokeVert *verts, /* Encode fill opacity defined by opacity modifier in vertex color alpha. If * no opacity modifier, the value will be always 1.0f. The opacity factor can be any * value between 0.0f and 2.0f */ - col->fcol[3] = (((int)(col->fcol[3] * 10000.0f)) * 10.0f) + gps->fill_opacity_fac; + col->fcol[3] = ((int)(col->fcol[3] * 10000.0f) * 10.0f) + gps->fill_opacity_fac; vert->strength = (round_cap0) ? pt->strength : -pt->strength; vert->u_stroke = pt->uv_fac; diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c index aa470b86869..eb94f46fe50 100644 --- a/source/blender/draw/intern/draw_cache_impl_lattice.c +++ b/source/blender/draw/intern/draw_cache_impl_lattice.c @@ -367,11 +367,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 = (ELEM(w, 0, 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 = (ELEM(v, 0, 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 = (ELEM(u, 0, 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)); diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 131e6c7a2af..9f445be9750 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -727,7 +727,7 @@ static void draw_subdiv_cache_update_extra_coarse_face_data(DRWSubdivCache *cach mesh->totpoly); } - uint32_t *flags_data = (uint32_t *)(GPU_vertbuf_get_data(cache->extra_coarse_face_data)); + uint32_t *flags_data = (uint32_t *)GPU_vertbuf_get_data(cache->extra_coarse_face_data); if (mr->extract_type == MR_EXTRACT_BMESH) { draw_subdiv_cache_extra_coarse_face_data_bm(cache->bm, mr->efa_act, flags_data); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index a63c26f70f2..f951b702403 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -172,7 +172,7 @@ void DRW_globals_update(void) /* M_SQRT2 to be at least the same size of the old square */ gb->size_vertex = U.pixelsize * - (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f)); + max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f); gb->size_vertex_gpencil = U.pixelsize * UI_GetThemeValuef(TH_GP_VERTEX_SIZE); gb->size_face_dot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE); gb->size_edge = U.pixelsize * (1.0f / 2.0f); /* TODO: Theme. */ diff --git a/source/blender/draw/intern/draw_fluid.c b/source/blender/draw/intern/draw_fluid.c index c34025ebe52..a14f6142cfb 100644 --- a/source/blender/draw/intern/draw_fluid.c +++ b/source/blender/draw/intern/draw_fluid.c @@ -208,7 +208,7 @@ static GPUTexture *create_volume_texture(const int dim[3], } else { /* We need to resize the input. */ - int channels = (ELEM(texture_format, GPU_R8, GPU_R16F, GPU_R32F)) ? 1 : 4; + int channels = ELEM(texture_format, GPU_R8, GPU_R16F, GPU_R32F) ? 1 : 4; float *rescaled_data = rescale_3d(dim, final_dim, channels, data); if (rescaled_data) { GPU_texture_update_sub(tex, GPU_DATA_FLOAT, rescaled_data, 0, 0, 0, UNPACK3(final_dim)); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 7bf6c7f0bb0..6dfd434d5c7 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1820,7 +1820,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, GPU_matrix_identity_set(); GPU_matrix_identity_projection_set(); const bool do_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 || - (ELEM(v3d->shading.type, OB_WIRE, OB_SOLID)) || + ELEM(v3d->shading.type, OB_WIRE, OB_SOLID) || (ELEM(v3d->shading.type, OB_MATERIAL) && (v3d->shading.flag & V3D_SHADING_SCENE_WORLD) == 0) || (ELEM(v3d->shading.type, OB_RENDER) && diff --git a/source/blender/draw/intern/draw_volume.cc b/source/blender/draw/intern/draw_volume.cc index 8f4383a98d8..2b4b0e3c089 100644 --- a/source/blender/draw/intern/draw_volume.cc +++ b/source/blender/draw/intern/draw_volume.cc @@ -184,7 +184,7 @@ static DRWShadingGroup *drw_volume_object_mesh_init(Scene *scene, /* Smoke Simulation */ if ((md = BKE_modifiers_findby_type(ob, eModifierType_Fluid)) && - (BKE_modifier_is_enabled(scene, md, eModifierMode_Realtime)) && + BKE_modifier_is_enabled(scene, md, eModifierMode_Realtime) && ((FluidModifierData *)md)->domain != nullptr) { FluidModifierData *fmd = (FluidModifierData *)md; FluidDomainSettings *fds = fmd->domain; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 8fd3c319452..3a04873588d 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1127,7 +1127,7 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id /* Check for selected nodes. */ if (fcu->rna_path && - (BLI_str_quoted_substr(fcu->rna_path, "nodes[", node_name, sizeof(node_name)))) { + BLI_str_quoted_substr(fcu->rna_path, "nodes[", node_name, sizeof(node_name))) { /* Get strip name, and check if this strip is selected. */ node = nodeFindNodebyName(ntree, node_name); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index db8088f78bb..f899e41149d 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -322,8 +322,8 @@ int ANIM_add_driver_with_target(ReportList *reports, * then use the first one */ { /* Use the shorter of the two (to avoid out of bounds access) */ - int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1; - int src_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr2, prop2) : 1; + int dst_len = RNA_property_array_check(prop) ? RNA_property_array_length(&ptr, prop) : 1; + int src_len = RNA_property_array_check(prop) ? RNA_property_array_length(&ptr2, prop2) : 1; int len = MIN2(dst_len, src_len); @@ -347,7 +347,7 @@ int ANIM_add_driver_with_target(ReportList *reports, case CREATEDRIVER_MAPPING_1_N: /* 1-N - Specified target index for all */ default: { - int len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1; + int len = RNA_property_array_check(prop) ? RNA_property_array_length(&ptr, prop) : 1; for (int i = 0; i < len; i++) { done_tot += add_driver_with_target(reports, diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 2a94c5db439..7bb104045c3 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -497,7 +497,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) if (ked && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { \ /* Only act on visible items, so check handle visibility state. */ \ const bool handles_visible = ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? \ - (BEZT_ISSEL_ANY(bezt)) : \ + BEZT_ISSEL_ANY(bezt) : \ true); \ if (handles_visible) { \ if (check(0)) { \ @@ -809,7 +809,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt) static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { - bezt->vec[1][0] = (float)(floorf(bezt->vec[1][0] + 0.5f)); + bezt->vec[1][0] = (float)floorf(bezt->vec[1][0] + 0.5f); } return 0; } @@ -1494,7 +1494,7 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt) { /* Only act on visible items, so check handle visibility state. */ const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? - (BEZT_ISSEL_ANY(bezt)) : + BEZT_ISSEL_ANY(bezt) : true); /* if we've got info on what to select, use it, otherwise select all */ @@ -1520,7 +1520,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) { /* Only act on visible items, so check handle visibility state. */ const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? - (BEZT_ISSEL_ANY(bezt)) : + BEZT_ISSEL_ANY(bezt) : true); /* if we've got info on what to deselect, use it, otherwise deselect all */ diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 40f0ac59b01..fbe65d6917e 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -151,7 +151,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo * if there is a considerable distance between the points, and also if the * current is further away than the next one is to the previous. */ - if (beztn && (IS_EQT(cur[0], next[0], thresh)) && (IS_EQT(next[1], prev[1], thresh) == 0)) { + if (beztn && IS_EQT(cur[0], next[0], thresh) && (IS_EQT(next[1], prev[1], thresh) == 0)) { /* only add if current is further away from previous */ if (cur[1] > next[1]) { if (IS_EQT(cur[1], prev[1], thresh) == 0) { @@ -654,8 +654,8 @@ void sample_fcurve(FCurve *fcu) * keyframes while sampling will affect the outcome... * - only start sampling+adding from index=1, so that we don't overwrite original keyframe */ - range = (int)(ceil(end->vec[1][0] - start->vec[1][0])); - sfra = (int)(floor(start->vec[1][0])); + range = (int)ceil(end->vec[1][0] - start->vec[1][0]); + sfra = (int)floor(start->vec[1][0]); if (range) { value_cache = MEM_callocN(sizeof(TempFrameValCache) * range, "IcuFrameValCache"); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index acf53541843..c9957b38853 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1180,7 +1180,7 @@ static float *get_keyframe_values(ReportList *reports, { float *values; - if ((flag & INSERTKEY_MATRIX) && (visualkey_can_use(&ptr, prop))) { + if ((flag & INSERTKEY_MATRIX) && visualkey_can_use(&ptr, prop)) { /* visual-keying is only available for object and pchan datablocks, as * it works by keyframing using a value extracted from the final matrix * instead of using the kt system to extract a value. diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index f9feac9c7f6..3448ba1c017 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -888,7 +888,7 @@ bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks) /* TODO: check for missing callbacks! */ /* check if it can be used in the current context */ - return (ksi->poll(ksi, C)); + return ksi->poll(ksi, C); } return true; diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index e490f21f16d..6b8f790d30f 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -2137,7 +2137,7 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op) int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0; if ((ebone_mirror = ED_armature_ebone_get_mirrored(arm->edbo, ebone)) && - (EBONE_VISIBLE(arm, ebone_mirror))) { + EBONE_VISIBLE(arm, ebone_mirror)) { const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror); flag_new |= flag_mirror; diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 98861dc2b63..14cd731f142 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -692,7 +692,7 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); bArmature *arm = armature_layers_get_data(&ob); PointerRNA ptr; - int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16; + int maxLayers = RNA_boolean_get(op->ptr, "all") ? 32 : 16; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ bool layers[32] = {false}; diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 6a31c7f1496..e75d748653b 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -1237,7 +1237,7 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op) int flag_new = extend ? PBONE_PREV_FLAG_GET(pchan) : 0; if ((pchan_mirror = BKE_pose_channel_get_mirrored(ob->pose, pchan->name)) && - (PBONE_VISIBLE(arm, pchan_mirror->bone))) { + PBONE_VISIBLE(arm, pchan_mirror->bone)) { const int flag_mirror = PBONE_PREV_FLAG_GET(pchan_mirror); flag_new |= flag_mirror; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 5e810d93115..cb6652507ed 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6817,7 +6817,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - int clear = (STREQ(op->idname, "CURVE_OT_shade_flat")); + int clear = STREQ(op->idname, "CURVE_OT_shade_flat"); uint objects_len; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( scene, view_layer, CTX_wm_view3d(C), &objects_len); diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index f2cc48049d7..15d6592baae 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -343,7 +343,7 @@ Nurb *ED_curve_add_nurbs_primitive( bp->vec[0] += fac * grid; fac = (float)b - 1.5f; bp->vec[1] += fac * grid; - if ((ELEM(a, 1, 2)) && (ELEM(b, 1, 2))) { + if (ELEM(a, 1, 2) && ELEM(b, 1, 2)) { bp->vec[2] += grid; } mul_m4_v3(mat, bp->vec); diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 4015ae545da..9c0c580f699 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -922,7 +922,7 @@ static void curve_select_more(Object *obedit) bp = nu->bp; selbpoints = BLI_BITMAP_NEW(a, "selectlist"); while (a > 0) { - if ((!BLI_BITMAP_TEST(selbpoints, a)) && (bp->hide == 0) && (bp->f1 & SELECT)) { + if (!BLI_BITMAP_TEST(selbpoints, a) && (bp->hide == 0) && (bp->f1 & SELECT)) { /* upper control point */ if (a % nu->pntsu != 0) { tempbp = bp - 1; diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index 6eac235a191..dca19dcf516 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -73,7 +73,7 @@ static void button2d_geom_draw_backdrop(const wmGizmo *gz, GPU_viewport_size_get_f(viewport); const float max_pixel_error = 0.25f; - int nsegments = (int)(ceilf(M_PI / acosf(1.0f - max_pixel_error / screen_scale))); + int nsegments = (int)ceilf(M_PI / acosf(1.0f - max_pixel_error / screen_scale)); nsegments = max_ff(nsegments, 8); nsegments = min_ff(nsegments, 1000); diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index ea34e6530fa..677bf1bb392 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -321,7 +321,7 @@ static void annotation_stroke_convertcoords(tGPsdata *p, int mval_i[2]; round_v2i_v2fl(mval_i, mval); if (annotation_project_check(p) && - (ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) { + ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth)) { /* projecting onto 3D-Geometry * - nothing more needs to be done here, since view_autodist_simple() has already done it */ @@ -1120,7 +1120,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, gpencil_point_to_xy(&p->gsc, gps, gps->points, &pc1[0], &pc1[1]); /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ if (len_v2v2_int(mval_i, pc1) <= radius) { /* free stroke */ @@ -1162,8 +1162,8 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, gpencil_point_to_xy(&p->gsc, gps, pt2, &pc2[0], &pc2[1]); /* Check that point segment of the bound-box of the eraser stroke. */ - if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { + if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + (!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1]) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * eraser region (either within stroke painted, or on its lines) * - this assumes that line-width is irrelevant. @@ -2520,7 +2520,7 @@ static int annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *eve * (Disabling RIGHTMOUSE case here results in bugs like T32647) * also making sure we have a valid event value, to not exit too early */ - if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && (ELEM(event->val, KM_PRESS, KM_RELEASE))) { + if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && ELEM(event->val, KM_PRESS, KM_RELEASE)) { /* if painting, end stroke */ if (p->status == GP_STATUS_PAINTING) { int sketch = 0; diff --git a/source/blender/editors/gpencil/gpencil_bake_animation.cc b/source/blender/editors/gpencil/gpencil_bake_animation.cc index ad19ac94646..1535fd614fe 100644 --- a/source/blender/editors/gpencil/gpencil_bake_animation.cc +++ b/source/blender/editors/gpencil/gpencil_bake_animation.cc @@ -260,7 +260,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op } /* Check if frame is in the list of frames to be exported. */ - if ((only_selected) && (!BLI_ghash_haskey(keyframe_list, POINTER_FROM_INT(i)))) { + if ((only_selected) && !BLI_ghash_haskey(keyframe_list, POINTER_FROM_INT(i))) { continue; } diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index bf78111a636..17ec33dc2bd 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -270,14 +270,13 @@ static void gpencil_timing_data_add_point(tGpTimingData *gtd, } else if (time < 0.0f) { /* This is a gap, negative value! */ - gtd->times[cur_point] = -(((float)(stroke_inittime - gtd->inittime)) + time + - gtd->offset_time); + gtd->times[cur_point] = -((float)(stroke_inittime - gtd->inittime) + time + gtd->offset_time); delta_time = -gtd->times[cur_point] - gtd->times[cur_point - 1]; gtd->gap_tot_time += delta_time; } else { - gtd->times[cur_point] = (((float)(stroke_inittime - gtd->inittime)) + time + gtd->offset_time); + gtd->times[cur_point] = ((float)(stroke_inittime - gtd->inittime) + time + gtd->offset_time); delta_time = gtd->times[cur_point] - fabsf(gtd->times[cur_point - 1]); } @@ -1483,7 +1482,7 @@ static bool gpencil_convert_poll(bContext *C) */ return ((area && area->spacetype == SPACE_VIEW3D) && (gpl = BKE_gpencil_layer_active_get(gpd)) && (gpf = BKE_gpencil_layer_frame_get(gpl, scene->r.cfra, GP_GETFRAME_USE_PREV)) && - (gpf->strokes.first) && (!GPENCIL_ANY_EDIT_MODE(gpd))); + (gpf->strokes.first) && !GPENCIL_ANY_EDIT_MODE(gpd)); } static int gpencil_convert_layer_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 9d101490283..6181b9810e3 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1618,7 +1618,7 @@ static bool gpencil_strokes_paste_poll(bContext *C) * 2) Copy buffer must at least have something (though it may be the wrong sort...). */ return (ED_gpencil_data_get_active(C) != NULL) && - (!BLI_listbase_is_empty(&gpencil_strokes_copypastebuf)); + !BLI_listbase_is_empty(&gpencil_strokes_copypastebuf); } typedef enum eGP_PasteMode { @@ -5014,7 +5014,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_is_single(&gpd_src->layers))) { + if ((mode == GP_SEPARATE_LAYER) && BLI_listbase_is_single(&gpd_src->layers)) { BKE_report(op->reports, RPT_ERROR, "Cannot separate an object with one layer only"); return OPERATOR_CANCELLED; } @@ -5463,7 +5463,7 @@ static bool gpencil_test_lasso(bGPDstroke *gps, gpencil_point_to_world_space(pt, diff_mat, &pt2); gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); /* test if in lasso */ - return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) && + return (!ELEM(V2D_IS_CLIPPED, x0, y0) && BLI_rcti_isect_pt(&data->rect, x0, y0) && BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX)); } diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 4cd2bebe4a7..cc25ed66b3d 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -690,7 +690,7 @@ static bool gpencil_interpolate_set_init_values(bContext *C, wmOperator *op, tGP tgpi->flag, (RNA_enum_get(op->ptr, "layers") == 1), GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS); SET_FLAG_FROM_TEST( tgpi->flag, - (GPENCIL_EDIT_MODE(tgpi->gpd) && (RNA_boolean_get(op->ptr, "interpolate_selected_only"))), + (GPENCIL_EDIT_MODE(tgpi->gpd) && RNA_boolean_get(op->ptr, "interpolate_selected_only")), GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED); tgpi->flipmode = RNA_enum_get(op->ptr, "flip"); diff --git a/source/blender/editors/gpencil/gpencil_mesh.cc b/source/blender/editors/gpencil/gpencil_mesh.cc index 50cd74e2b5a..d847fbe2aea 100644 --- a/source/blender/editors/gpencil/gpencil_mesh.cc +++ b/source/blender/editors/gpencil/gpencil_mesh.cc @@ -278,7 +278,7 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op) } /* Check if frame is in the list of frames to be exported. */ - if ((only_selected) && (!BLI_ghash_haskey(keyframe_list, POINTER_FROM_INT(i)))) { + if ((only_selected) && !BLI_ghash_haskey(keyframe_list, POINTER_FROM_INT(i))) { continue; } diff --git a/source/blender/editors/gpencil/gpencil_ops_versioning.c b/source/blender/editors/gpencil/gpencil_ops_versioning.c index 50fbafff732..60b58b6f513 100644 --- a/source/blender/editors/gpencil/gpencil_ops_versioning.c +++ b/source/blender/editors/gpencil/gpencil_ops_versioning.c @@ -122,7 +122,7 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *op) LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - if ((gps->colorname[0] != '\0') && (STREQ(gps->colorname, palcolor->info))) { + if ((gps->colorname[0] != '\0') && STREQ(gps->colorname, palcolor->info)) { gps->mat_nr = ob->totcol - 1; gps->colorname[0] = '\0'; /* weights array */ @@ -160,7 +160,7 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *op) gpl->tintcolor[3] = 0.0f; LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - if ((gps->colorname[0] != '\0') && (STREQ(gps->colorname, palcolor->info))) { + if ((gps->colorname[0] != '\0') && STREQ(gps->colorname, palcolor->info)) { /* copy color settings */ copy_v4_v4(gpl->color, palcolor->color); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ae971dcb2ed..a82288e3377 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -434,8 +434,7 @@ static void gpencil_stroke_convertcoords(tGPsdata *p, rmval[1] = mval[1] - 0.5f; round_v2i_v2fl(mval_i, rmval); - if (gpencil_project_check(p) && - (ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) { + if (gpencil_project_check(p) && ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth)) { /* projecting onto 3D-Geometry * - nothing more needs to be done here, since view_autodist_simple() has already done it */ @@ -1386,7 +1385,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) gpencil_update_cache(p->gpd); BKE_gpencil_tag_full_update( - p->gpd, gpl, (GPENCIL_MULTIEDIT_SESSIONS_ON(p->gpd)) ? NULL : p->gpf, NULL); + p->gpd, gpl, GPENCIL_MULTIEDIT_SESSIONS_ON(p->gpd) ? NULL : p->gpf, NULL); } /* --- 'Eraser' for 'Paint' Tool ------ */ @@ -1553,7 +1552,7 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p, gpencil_point_to_world_space(gps->points, p->diff_mat, &pt_temp); gpencil_point_to_xy(&p->gsc, gps, &pt_temp, &pc1[0], &pc1[1]); /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ if (len_v2v2_int(mval_i, pc1) <= radius) { /* free stroke */ @@ -1578,7 +1577,7 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p, gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ if (len_v2v2_int(mval_i, pc1) <= radius) { /* free stroke */ @@ -1648,9 +1647,9 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p, } /* Check that point segment of the bound-box of the eraser stroke. */ - if (((!ELEM(V2D_IS_CLIPPED, pc0[0], pc0[1])) && BLI_rcti_isect_pt(rect, pc0[0], pc0[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { + if ((!ELEM(V2D_IS_CLIPPED, pc0[0], pc0[1]) && BLI_rcti_isect_pt(rect, pc0[0], pc0[1])) || + (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + (!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1]) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * eraser region (either within stroke painted, or on its lines) * - this assumes that line-width is irrelevant. @@ -3737,7 +3736,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * (Disabling RIGHTMOUSE case here results in bugs like T32647) * also making sure we have a valid event value, to not exit too early */ - if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && (ELEM(event->val, KM_PRESS, KM_RELEASE))) { + if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && ELEM(event->val, KM_PRESS, KM_RELEASE)) { /* if painting, end stroke */ if (p->status == GP_STATUS_PAINTING) { p->status = GP_STATUS_DONE; diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 67774b97c10..b693d4ae185 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -1515,7 +1515,7 @@ static void gpencil_primitive_edit_event_handling( break; } case EVT_MKEY: { - if ((event->val == KM_PRESS) && (tgpi->curve) && (ELEM(tgpi->orign_type, GP_STROKE_ARC))) { + if ((event->val == KM_PRESS) && (tgpi->curve) && ELEM(tgpi->orign_type, GP_STROKE_ARC)) { tgpi->flip ^= 1; gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); @@ -1808,14 +1808,14 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } } else if ((event->val == KM_RELEASE) && (tgpi->flag == IN_PROGRESS) && - (!ELEM(tgpi->type, GP_STROKE_POLYLINE))) { + !ELEM(tgpi->type, GP_STROKE_POLYLINE)) { /* set control points and enter edit mode */ tgpi->flag = IN_CURVE_EDIT; gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } else if ((event->val == KM_RELEASE) && (tgpi->flag == IN_PROGRESS) && - (!ELEM(tgpi->type, GP_STROKE_CURVE, GP_STROKE_POLYLINE))) { + !ELEM(tgpi->type, GP_STROKE_CURVE, GP_STROKE_POLYLINE)) { /* stop drawing primitive */ tgpi->flag = IDLE; gpencil_primitive_interaction_end(C, op, win, tgpi); @@ -1823,7 +1823,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_FINISHED; } else if ((event->val == KM_RELEASE) && (tgpi->flag == IN_PROGRESS) && - (ELEM(tgpi->type, GP_STROKE_POLYLINE))) { + ELEM(tgpi->type, GP_STROKE_POLYLINE)) { /* set control points and enter edit mode */ tgpi->flag = IN_POLYLINE; gpencil_primitive_update(C, op, tgpi); diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 1df106d2754..9b934876ebb 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1472,7 +1472,7 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ int mval_i[2]; round_v2i_v2fl(mval_i, gso->mval); @@ -1511,8 +1511,8 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso, gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the bound-box of the selection stroke. */ - if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { + if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + (!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1]) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * brush region (either within stroke painted, or on its lines) * - this assumes that line-width is irrelevant. @@ -1620,14 +1620,14 @@ static bool gpencil_sculpt_brush_do_frame(bContext *C, { bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps; - if ((is_automasking) && (!BLI_ghash_haskey(gso->automasking_strokes, gps_active))) { + if ((is_automasking) && !BLI_ghash_haskey(gso->automasking_strokes, gps_active)) { continue; } } /* Check if the stroke collide with brush. */ if ((gps->totpoints > 1) && - (!ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat))) { + !ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat)) { continue; } @@ -1908,7 +1908,7 @@ static bool gpencil_sculpt_brush_apply_standard(bContext *C, tGP_BrushEditData * /* Find visible strokes, and perform operations on those if hit */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { /* If no active frame, don't do anything... */ - if ((!BKE_gpencil_layer_is_editable(gpl)) || (gpl->actframe == NULL)) { + if (!BKE_gpencil_layer_is_editable(gpl) || (gpl->actframe == NULL)) { continue; } diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 16eff0fe41d..13455861924 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -94,13 +94,13 @@ static bool gpencil_select_poll(bContext *C) ToolSettings *ts = CTX_data_tool_settings(C); if (GPENCIL_SCULPT_MODE(gpd)) { - if (!(GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt))) { + if (!GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt)) { return false; } } if (GPENCIL_VERTEX_MODE(gpd)) { - if (!(GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex))) { + if (!GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex)) { return false; } } @@ -267,7 +267,7 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op) /* For sculpt mode, if mask is disable, only allows deselect */ if (GPENCIL_SCULPT_MODE(gpd)) { ToolSettings *ts = CTX_data_tool_settings(C); - if ((!(GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt))) && (action != SEL_DESELECT)) { + if (!GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt) && (action != SEL_DESELECT)) { return OPERATOR_CANCELLED; } } @@ -529,7 +529,7 @@ static int gpencil_select_random_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); ToolSettings *ts = CTX_data_tool_settings(C); bGPdata *gpd = ED_gpencil_data_get_active(C); - if ((gpd == NULL) || (GPENCIL_NONE_EDIT_MODE(gpd))) { + if ((gpd == NULL) || GPENCIL_NONE_EDIT_MODE(gpd)) { return OPERATOR_CANCELLED; } @@ -1501,7 +1501,7 @@ static bool gpencil_stroke_do_circle_sel(bGPdata *gpd, gpencil_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); /* do boundbox check first */ - if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) { + if (!ELEM(V2D_IS_CLIPPED, x0, y0) && BLI_rcti_isect_pt(rect, x0, y0)) { /* only check if point is inside */ if (((x0 - mx) * (x0 - mx) + (y0 - my) * (y0 - my)) <= radius * radius) { hit = true; @@ -2040,7 +2040,7 @@ static bool gpencil_generic_stroke_select(bContext *C, gpencil_point_conversion_init(C, &gsc); /* deselect all strokes first? */ - if (SEL_OP_USE_PRE_DESELECT(sel_op) || (GPENCIL_PAINT_MODE(gpd))) { + if (SEL_OP_USE_PRE_DESELECT(sel_op) || GPENCIL_PAINT_MODE(gpd)) { /* Set selection index to 0. */ gpd->select_last_index = 0; @@ -2767,7 +2767,7 @@ static bool gpencil_select_vertex_color_poll(bContext *C) bGPdata *gpd = (bGPdata *)ob->data; if (GPENCIL_VERTEX_MODE(gpd)) { - if (!(GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex))) { + if (!GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex)) { return false; } diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 1849614b403..cc13f667e48 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -518,7 +518,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 (ELEM(area->spacetype, SPACE_VIEW3D, SPACE_PROPERTIES)); + return ELEM(area->spacetype, SPACE_VIEW3D, SPACE_PROPERTIES); } if (gps->flag & GP_STROKE_2DIMAGE) { /* Special "image" strokes - only in Image Editor */ @@ -854,7 +854,7 @@ void gpencil_stroke_convertcoords_tpoint(Scene *scene, int mval_i[2]; round_v2i_v2fl(mval_i, point2D->m_xy); - if ((depth != NULL) && (ED_view3d_autodist_simple(region, mval_i, r_out, 0, depth))) { + if ((depth != NULL) && ED_view3d_autodist_simple(region, mval_i, r_out, 0, depth)) { /* projecting onto 3D-Geometry * - nothing more needs to be done here, since view_autodist_simple() has already done it */ @@ -1662,11 +1662,11 @@ static bool gpencil_check_cursor_region(bContext *C, const int mval_i[2]) ScrArea *area = CTX_wm_area(C); Object *ob = CTX_data_active_object(C); - if ((ob == NULL) || (!ELEM(ob->mode, - OB_MODE_PAINT_GPENCIL, - OB_MODE_SCULPT_GPENCIL, - OB_MODE_WEIGHT_GPENCIL, - OB_MODE_VERTEX_GPENCIL))) { + if ((ob == NULL) || !ELEM(ob->mode, + OB_MODE_PAINT_GPENCIL, + OB_MODE_SCULPT_GPENCIL, + OB_MODE_WEIGHT_GPENCIL, + OB_MODE_VERTEX_GPENCIL)) { return false; } @@ -1755,7 +1755,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat const int mval_i[2] = {x, y}; /* Check if cursor is in drawing region and has valid data-block. */ - if ((!gpencil_check_cursor_region(C, mval_i)) || (gpd == NULL)) { + if (!gpencil_check_cursor_region(C, mval_i) || (gpd == NULL)) { return; } @@ -1793,7 +1793,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat * is too disruptive and the size of cursor does not change with zoom factor. * The decision was to use a fix size, instead of brush->thickness value. */ - if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) && + if ((gp_style) && GPENCIL_PAINT_MODE(gpd) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && (brush->gpencil_tool == GPAINT_TOOL_DRAW)) { @@ -1878,7 +1878,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat /* Inner Ring: Color from UI panel */ immUniformColor4f(color[0], color[1], color[2], 0.8f); - if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) && + if ((gp_style) && GPENCIL_PAINT_MODE(gpd) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && (brush->gpencil_tool == GPAINT_TOOL_DRAW)) { @@ -2751,7 +2751,7 @@ void ED_gpencil_init_random_settings(Brush *brush, const int mval[2], GpRandomSettings *random_settings) { - int seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; + int seed = ((uint)ceil(PIL_check_seconds_timer()) + 1) % 128; /* Use mouse position to get randomness. */ int ix = mval[0] * seed; int iy = mval[1] * seed; @@ -2797,7 +2797,7 @@ static void gpencil_sbuffer_vertex_color_random( { BrushGpencilSettings *brush_settings = brush->gpencil_settings; if (brush_settings->flag & GP_BRUSH_GROUP_RANDOM) { - int seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; + int seed = ((uint)ceil(PIL_check_seconds_timer()) + 1) % 128; int ix = (int)(tpt->m_xy[0] * seed); int iy = (int)(tpt->m_xy[1] * seed); @@ -3020,7 +3020,7 @@ bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps, BLI_lasso_boundbox(&rect, mcoords, len); /* Test if point inside stroke. */ - hit = ((!ELEM(V2D_IS_CLIPPED, mval[0], mval[1])) && BLI_rcti_isect_pt(&rect, mval[0], mval[1]) && + hit = (!ELEM(V2D_IS_CLIPPED, mval[0], mval[1]) && BLI_rcti_isect_pt(&rect, mval[0], mval[1]) && BLI_lasso_is_point_inside(mcoords, len, mval[0], mval[1], INT_MAX)); /* Free memory. */ @@ -3088,8 +3088,8 @@ bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C, } /* Check if one of the ends is inside target stroke bounding box. */ - if ((!ED_gpencil_stroke_check_collision(gsc, gps_target, pt2d_start, radius, diff_mat)) && - (!ED_gpencil_stroke_check_collision(gsc, gps_target, pt2d_end, radius, diff_mat))) { + if (!ED_gpencil_stroke_check_collision(gsc, gps_target, pt2d_start, radius, diff_mat) && + !ED_gpencil_stroke_check_collision(gsc, gps_target, pt2d_end, radius, diff_mat)) { continue; } /* Check the distance of the ends with the ends of target stroke to avoid middle contact. diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index 75b5ce8dd48..ca0729ecb94 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -851,7 +851,7 @@ static bool gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ int mval_i[2]; round_v2i_v2fl(mval_i, gso->mval); @@ -891,8 +891,8 @@ static bool gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the bound-box of the selection stroke. */ - if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { + if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + (!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1]) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * brush region (either within stroke painted, or on its lines) * - this assumes that line-width is irrelevant. @@ -957,7 +957,7 @@ static bool gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, } /* If nothing hit, check if the mouse is inside any filled stroke. */ - if ((!hit) && (ELEM(tool, GPAINT_TOOL_TINT, GPVERTEX_TOOL_DRAW))) { + if ((!hit) && ELEM(tool, GPAINT_TOOL_TINT, GPVERTEX_TOOL_DRAW)) { MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(gso->object, gps_active->mat_nr + 1); if (gp_style->flag & GP_MATERIAL_FILL_SHOW) { @@ -1113,7 +1113,7 @@ static bool gpencil_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVert /* Find visible strokes, and perform operations on those if hit */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { /* If locked or no active frame, don't do anything. */ - if ((!BKE_gpencil_layer_is_editable(gpl)) || (gpl->actframe == NULL)) { + if (!BKE_gpencil_layer_is_editable(gpl) || (gpl->actframe == NULL)) { continue; } diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index 8a949db5c5f..f73c6f8c658 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -418,7 +418,7 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* Do bound-box check first. */ - if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { + if (!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ int mval_i[2]; round_v2i_v2fl(mval_i, gso->mval); @@ -447,8 +447,8 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the bound-box of the selection stroke */ - if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || - ((!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1])) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { + if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1]) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || + (!ELEM(V2D_IS_CLIPPED, pc2[0], pc2[1]) && BLI_rcti_isect_pt(rect, pc2[0], pc2[1]))) { /* Check if point segment of stroke had anything to do with * brush region (either within stroke painted, or on its lines) * - this assumes that line-width is irrelevant. @@ -579,7 +579,7 @@ static bool gpencil_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeig /* Find visible strokes, and perform operations on those if hit */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { /* If locked or no active frame, don't do anything. */ - if ((!BKE_gpencil_layer_is_editable(gpl)) || (gpl->actframe == NULL)) { + if (!BKE_gpencil_layer_is_editable(gpl) || (gpl->actframe == NULL)) { continue; } diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index ec922ea301b..422fc34aa50 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -6663,8 +6663,8 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) /* enum property */ ptr = &but->rnapoin; prop = but->rnaprop; - value = (ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_TAB)) ? int(but->hardmax) : - int(ui_but_value_get(but)); + value = ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_TAB) ? int(but->hardmax) : + int(ui_but_value_get(but)); } else if (but->optype) { PointerRNA *opptr = UI_but_operator_ptr_get(but); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 56e02873b04..34f33b71fb8 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4611,7 +4611,7 @@ static int ui_do_but_TEX( if (data->state == BUTTON_STATE_HIGHLIGHT) { if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { - if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && (!UI_but_is_utf8(but))) { + if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && !UI_but_is_utf8(but)) { /* pass - allow filesel, enter to execute */ } else if (ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS) && @@ -5137,7 +5137,7 @@ static bool ui_numedit_but_NUM(uiButNumber *number_but, CLAMP_MIN(non_linear_scale, 0.5f * UI_DPI_FAC); } - data->dragf += (((float)(mx - data->draglastx)) / deler) * non_linear_scale; + data->dragf += ((float)(mx - data->draglastx) / deler) * non_linear_scale; if (but->softmin == softmin) { CLAMP_MIN(data->dragf, 0.0f); @@ -5762,7 +5762,7 @@ static int ui_do_but_SLI( else #endif { - f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); + f = (float)(mx - but->rect.xmin) / BLI_rctf_size_x(&but->rect); } if (scale_type == PROP_SCALE_LOG) { @@ -5969,7 +5969,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co } } #ifdef USE_DRAG_TOGGLE - if (event->type == LEFTMOUSE && event->val == KM_PRESS && (ui_but_is_drag_toggle(but))) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS && ui_but_is_drag_toggle(but)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->xy[0]; data->dragstarty = event->xy[1]; @@ -6973,7 +6973,7 @@ static bool ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int m return changed; } - const float dx = ((float)(mx - data->draglastx)) / BLI_rctf_size_x(&but->rect); + const float dx = (float)(mx - data->draglastx) / BLI_rctf_size_x(&but->rect); data->dragcbd->pos += dx; CLAMP(data->dragcbd->pos, 0.0f, 1.0f); @@ -6999,7 +6999,7 @@ static int ui_do_but_COLORBAND( if (event->modifier & KM_CTRL) { /* insert new key on mouse location */ - const float pos = ((float)(mx - but->rect.xmin)) / BLI_rctf_size_x(&but->rect); + const float pos = (float)(mx - but->rect.xmin) / BLI_rctf_size_x(&but->rect); BKE_colorband_element_add(coba, pos); button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -10804,7 +10804,7 @@ static int ui_handle_menu_return_submenu(bContext *C, static bool ui_but_pie_menu_supported_apply(uiBut *but) { - return (!ELEM(but->type, UI_BTYPE_NUM_SLIDER, UI_BTYPE_NUM)); + return !ELEM(but->type, UI_BTYPE_NUM_SLIDER, UI_BTYPE_NUM); } static int ui_but_pie_menu_apply(bContext *C, @@ -11078,7 +11078,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle case EVT_XKEY: case EVT_YKEY: case EVT_ZKEY: { - if ((ELEM(event->val, KM_PRESS, KM_DBL_CLICK)) && + if (ELEM(event->val, KM_PRESS, KM_DBL_CLICK) && ((event->modifier & (KM_SHIFT | KM_CTRL | KM_OSKEY)) == 0)) { LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (but->menu_key == event->type) { @@ -11345,9 +11345,9 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE (ui_region_find_active_but(data->menu->region) == NULL) && /* make sure mouse isn't inside another menu (see T43247) */ (ui_screen_region_find_mouse_over(screen, event) == NULL) && - (ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) && + ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU) && (but_other = ui_but_find_mouse_over(region, event)) && (but != but_other) && - (ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) && + ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU) && /* Hover-opening menu's doesn't work well for buttons over one another * along the same axis the menu is opening on (see T71719). */ (((data->menu->direction & (UI_DIR_LEFT | UI_DIR_RIGHT)) && diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 5d71e828d05..c080dce0f08 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -821,7 +821,7 @@ static ImBuf *create_mono_icon_with_border(ImBuf *buf, blend_color_interpolate_float(dest_rgba, orig_rgba, border_rgba, 1.0 - orig_rgba[3]); linearrgb_to_srgb_v4(dest_srgb, dest_rgba); - const uint alpha_mask = ((uint)(dest_srgb[3] * 255)) << 24; + const uint alpha_mask = (uint)(dest_srgb[3] * 255) << 24; const uint cpack = rgb_to_cpack(dest_srgb[0], dest_srgb[1], dest_srgb[2]) | alpha_mask; result->rect[offset_write] = cpack; } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index d002dd643c3..c906a5b36f1 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2112,11 +2112,11 @@ void uiItemFullR(uiLayout *layout, icon = ICON_CHECKBOX_DEHLT; /* but->iconadd will set to correct icon */ } else if (is_array) { - icon = (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT : - ICON_CHECKBOX_DEHLT; + icon = RNA_property_boolean_get_index(ptr, prop, index) ? ICON_CHECKBOX_HLT : + ICON_CHECKBOX_DEHLT; } else { - icon = (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; + icon = RNA_property_boolean_get(ptr, prop) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; } } } diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc index 480c3e00e6e..7ff6acee945 100644 --- a/source/blender/editors/interface/interface_query.cc +++ b/source/blender/editors/interface/interface_query.cc @@ -251,7 +251,7 @@ bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEv /* use button size itself */ } else if (but->drawflag & UI_BUT_ICON_LEFT) { - rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect)); + rect.xmax = rect.xmin + BLI_rcti_size_y(&rect); } else { const int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect); diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc index 515a69c19c9..38a7e025572 100644 --- a/source/blender/editors/interface/interface_template_search_menu.cc +++ b/source/blender/editors/interface/interface_template_search_menu.cc @@ -473,8 +473,7 @@ static MenuSearch_Data *menu_items_from_ui_create( * as the outliner only exposes functionality via the context menu. */ GHashIterator iter; - for (WM_menutype_iter(&iter); (!BLI_ghashIterator_done(&iter)); - (BLI_ghashIterator_step(&iter))) { + for (WM_menutype_iter(&iter); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { MenuType *mt = (MenuType *)BLI_ghashIterator_getValue(&iter); if (BLI_str_endswith(mt->idname, "_context_menu")) { BLI_gset_add(menu_tagged, mt); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 86971dd7778..d21f969e431 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1415,7 +1415,7 @@ static void template_ID(const bContext *C, UI_but_funcN_set( but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ALONE)); - if ((!BKE_id_copy_is_allowed(id)) || (idfrom && idfrom->lib) || (!editable) || + if (!BKE_id_copy_is_allowed(id) || (idfrom && idfrom->lib) || (!editable) || /* object in editmode - don't change data */ (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) { UI_but_flag_enable(but, UI_BUT_DISABLED); @@ -1442,7 +1442,7 @@ static void template_ID(const bContext *C, UI_UNIT_Y, NULL); } - else if (!(ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS)) && + else if (!ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS) && (hide_buttons == false)) { uiDefIconButR(block, UI_BTYPE_ICON_TOGGLE, @@ -3665,7 +3665,7 @@ static void colorband_buttons_layout(uiLayout *layout, UI_UNIT_Y, &coba->cur, 0.0, - (float)(MAX2(0, coba->tot - 1)), + (float)MAX2(0, coba->tot - 1), 0, 0, TIP_("Choose active color stop")); @@ -3696,7 +3696,7 @@ static void colorband_buttons_layout(uiLayout *layout, UI_UNIT_Y, &coba->cur, 0.0, - (float)(MAX2(0, coba->tot - 1)), + (float)MAX2(0, coba->tot - 1), 0, 0, TIP_("Choose active color stop")); diff --git a/source/blender/editors/interface/view2d_edge_pan.cc b/source/blender/editors/interface/view2d_edge_pan.cc index 2d8c6970332..897a638dfe5 100644 --- a/source/blender/editors/interface/view2d_edge_pan.cc +++ b/source/blender/editors/interface/view2d_edge_pan.cc @@ -82,8 +82,8 @@ void UI_view2d_edge_pan_init(bContext *C, /* Calculate translation factor, based on size of view. */ const float winx = float(BLI_rcti_size_x(&vpd->region->winrct) + 1); const float winy = float(BLI_rcti_size_y(&vpd->region->winrct) + 1); - vpd->facx = (BLI_rctf_size_x(&vpd->v2d->cur)) / winx; - vpd->facy = (BLI_rctf_size_y(&vpd->v2d->cur)) / winy; + vpd->facx = BLI_rctf_size_x(&vpd->v2d->cur) / winx; + vpd->facy = BLI_rctf_size_y(&vpd->v2d->cur) / winy; UI_view2d_edge_pan_reset(vpd); } diff --git a/source/blender/editors/interface/view2d_ops.cc b/source/blender/editors/interface/view2d_ops.cc index 9b2c17bd73e..30c5e79a794 100644 --- a/source/blender/editors/interface/view2d_ops.cc +++ b/source/blender/editors/interface/view2d_ops.cc @@ -129,8 +129,8 @@ static void view_pan_init(bContext *C, wmOperator *op) /* calculate translation factor - based on size of view */ const float winx = float(BLI_rcti_size_x(&vpd->region->winrct) + 1); const float winy = float(BLI_rcti_size_y(&vpd->region->winrct) + 1); - vpd->facx = (BLI_rctf_size_x(&vpd->v2d->cur)) / winx; - vpd->facy = (BLI_rctf_size_y(&vpd->v2d->cur)) / winy; + vpd->facx = BLI_rctf_size_x(&vpd->v2d->cur) / winx; + vpd->facy = BLI_rctf_size_y(&vpd->v2d->cur) / winy; vpd->v2d->flag |= V2D_IS_NAVIGATING; } @@ -1863,7 +1863,7 @@ static void scroller_activate_init(bContext *C, vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / float(BLI_rcti_size_x(®ion->winrct) + 1); + vsm->fac_round = BLI_rctf_size_x(&v2d->cur) / float(BLI_rcti_size_x(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( @@ -1883,7 +1883,7 @@ static void scroller_activate_init(bContext *C, vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / float(BLI_rcti_size_y(®ion->winrct) + 1); + vsm->fac_round = BLI_rctf_size_y(&v2d->cur) / float(BLI_rcti_size_y(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c index eb53f66d8b8..c7a6b20af7b 100644 --- a/source/blender/editors/io/io_gpencil_import.c +++ b/source/blender/editors/io/io_gpencil_import.c @@ -66,7 +66,7 @@ static int wm_gpencil_import_svg_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false) || - !(RNA_struct_find_property(op->ptr, "directory"))) { + !RNA_struct_find_property(op->ptr, "directory")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index df30870007f..0ee1fc15d7f 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -845,7 +845,7 @@ static void define_primitive_add_properties(wmOperatorType *ot) static int primitive_circle_add_exec(bContext *C, wmOperator *op) { const float points[4][2] = {{0.0f, 0.5f}, {0.5f, 1.0f}, {1.0f, 0.5f}, {0.5f, 0.0f}}; - int num_points = sizeof(points) / (sizeof(float[2])); + int num_points = sizeof(points) / sizeof(float[2]); create_primitive_from_points(C, op, points, num_points, HD_AUTO); @@ -880,7 +880,7 @@ void MASK_OT_primitive_circle_add(wmOperatorType *ot) static int primitive_square_add_exec(bContext *C, wmOperator *op) { const float points[4][2] = {{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}}; - int num_points = sizeof(points) / (sizeof(float[2])); + int num_points = sizeof(points) / sizeof(float[2]); create_primitive_from_points(C, op, points, num_points, HD_VECT); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 3b16497f09f..4bbb656c475 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -349,9 +349,9 @@ static void draw_spline_points(const bContext *C, static void mask_color_active_tint(uchar r_rgb[4], const uchar rgb[4], const bool is_active) { if (!is_active) { - r_rgb[0] = (uchar)((((int)(rgb[0])) + 128) / 2); - r_rgb[1] = (uchar)((((int)(rgb[1])) + 128) / 2); - r_rgb[2] = (uchar)((((int)(rgb[2])) + 128) / 2); + r_rgb[0] = (uchar)(((int)rgb[0] + 128) / 2); + r_rgb[1] = (uchar)(((int)rgb[1] + 128) / 2); + r_rgb[2] = (uchar)(((int)rgb[2] + 128) / 2); r_rgb[3] = rgb[3]; } else { diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 9819532224e..8ec6c356fd7 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -287,7 +287,7 @@ void ED_masklayer_frames_duplicate(MaskLayer *mask_layer) static bool snap_mask_layer_nearest(MaskLayerShape *mask_layer_shape, Scene *UNUSED(scene)) { if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { - mask_layer_shape->frame = (int)(floor(mask_layer_shape->frame + 0.5)); + mask_layer_shape->frame = (int)floor(mask_layer_shape->frame + 0.5); } return false; } diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index c78279b7971..3284cd70646 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -751,7 +751,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event) } } /* Update offset accordingly to new offset_type. */ - if (!has_numinput && (ELEM(opdata->value_mode, OFFSET_VALUE, OFFSET_VALUE_PERCENT))) { + if (!has_numinput && ELEM(opdata->value_mode, OFFSET_VALUE, OFFSET_VALUE_PERCENT)) { edbm_bevel_mouse_set_value(op, event); } edbm_bevel_calc(op); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8130b0ac83d..e9897021b4a 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -3016,7 +3016,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) knife_project_v2(kcd, v->cageco, s); float d = dist_squared_to_line_segment_v2(s, s1, s2); if ((d <= vert_tol_sq) && - (point_is_visible(kcd, v->cageco, s, bm_elem_from_knife_vert(v, &kfe_hit)))) { + point_is_visible(kcd, v->cageco, s, bm_elem_from_knife_vert(v, &kfe_hit))) { kfv_is_in_cut = true; } } diff --git a/source/blender/editors/mesh/editmesh_preselect_edgering.c b/source/blender/editors/mesh/editmesh_preselect_edgering.c index 0773533bc5c..832390331c3 100644 --- a/source/blender/editors/mesh/editmesh_preselect_edgering.c +++ b/source/blender/editors/mesh/editmesh_preselect_edgering.c @@ -182,7 +182,7 @@ void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const fl /* Same size as an edit mode vertex */ immUniform1f("size", 2.0 * U.pixelsize * - (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f))); + max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f)); immBegin(GPU_PRIM_POINTS, psel->verts_len); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 0c137c94d57..2e7fbb0200d 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -326,7 +326,7 @@ static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e) { /* try step in a direction, if it fails we know do go the other way */ BMVert *v_test = e->v1; - return (edbm_ripsel_edge_uid_step(e, &v_test)) ? e->v1 : e->v2; + return edbm_ripsel_edge_uid_step(e, &v_test) ? e->v1 : e->v2; } static void edbm_ripsel_deselect_helper(BMesh *bm, @@ -914,7 +914,7 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed /* NOTE: if the case of 3 edges has one change in loop stepping, * if this becomes more involved we may be better off splitting * the 3 edge case into its own else-if branch */ - if ((ELEM(totedge_manifold, 4, 3)) || (all_manifold == false)) { + if (ELEM(totedge_manifold, 4, 3) || (all_manifold == false)) { BMLoop *l_a = e_best->l; BMLoop *l_b = l_a->radial_next; diff --git a/source/blender/editors/mesh/editmesh_select.cc b/source/blender/editors/mesh/editmesh_select.cc index fcd3e579b06..0d1e3c08d84 100644 --- a/source/blender/editors/mesh/editmesh_select.cc +++ b/source/blender/editors/mesh/editmesh_select.cc @@ -1078,7 +1078,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, BMEdge *e; BMIter eiter; BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { - if ((BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false) && (BM_edge_is_boundary(e))) { + if ((BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false) && BM_edge_is_boundary(e)) { if (use_vert && use_boundary_vertices) { for (uint j = 0; j < 2; j++) { BMVert *v = *((&e->v1) + j); @@ -4632,7 +4632,7 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op) if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if ((use_wire && BM_edge_is_wire(e)) || (use_boundary && BM_edge_is_boundary(e)) || (use_non_contiguous && (BM_edge_is_manifold(e) && !BM_edge_is_contiguous(e))) || - (use_multi_face && (BM_edge_face_count_is_over(e, 2)))) { + (use_multi_face && BM_edge_face_count_is_over(e, 2))) { /* check we never select perfect edge (in test above) */ BLI_assert(!(BM_edge_is_manifold(e) && BM_edge_is_contiguous(e))); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 8d505bbca3e..4b6ce69294f 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -191,7 +191,7 @@ static bool multiresbake_check(bContext *C, wmOperator *op) ok = false; } - if (ibuf->rect_float && !(ELEM(ibuf->channels, 0, 4))) { + if (ibuf->rect_float && !ELEM(ibuf->channels, 0, 4)) { ok = false; } diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index 4581c6a6502..872d2367332 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -892,7 +892,7 @@ bool ED_object_modifier_apply(Main *bmain, BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data"); return false; } - if ((ob->mode & OB_MODE_SCULPT) && (find_multires_modifier_before(scene, md)) && + if ((ob->mode & OB_MODE_SCULPT) && find_multires_modifier_before(scene, md) && (BKE_modifier_is_same_topology(md) == false)) { BKE_report(reports, RPT_ERROR, @@ -1436,7 +1436,7 @@ static bool modifier_apply_poll(bContext *C) return false; } if (md != nullptr) { - if ((ob->mode & OB_MODE_SCULPT) && (find_multires_modifier_before(scene, md)) && + if ((ob->mode & OB_MODE_SCULPT) && find_multires_modifier_before(scene, md) && (BKE_modifier_is_same_topology(md) == false)) { CTX_wm_operator_poll_msg_set( C, "Constructive modifier cannot be applied to multi-res data in sculpt mode"); @@ -1996,8 +1996,8 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - const eMultiresSubdivideModeType subdivide_mode = (eMultiresSubdivideModeType)(RNA_enum_get( - op->ptr, "mode")); + const eMultiresSubdivideModeType subdivide_mode = (eMultiresSubdivideModeType)RNA_enum_get( + op->ptr, "mode"); multiresModifier_subdivide(object, mmd, subdivide_mode); ED_object_iter_other( @@ -2419,7 +2419,7 @@ static void modifier_skin_customdata_delete(Object *ob) static bool skin_poll(bContext *C) { - return (edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), false, false)); + return edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), false, false); } static bool skin_edit_poll(bContext *C) diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 43867877fdb..ee0a07bd7be 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -881,7 +881,7 @@ static bool select_grouped_object_hooks(bContext *C, Object *ob) if (hmd->object) { BKE_view_layer_synced_ensure(scene, view_layer); base = BKE_view_layer_base_find(view_layer, hmd->object); - if (base && ((base->flag & BASE_SELECTED) == 0) && (BASE_SELECTABLE(v3d, base))) { + if (base && ((base->flag & BASE_SELECTED) == 0) && BASE_SELECTABLE(v3d, base)) { ED_object_base_select(base, BA_SELECT); changed = true; } @@ -958,7 +958,7 @@ static bool select_grouped_color(bContext *C, Object *ob) CTX_DATA_BEGIN (C, Base *, base, selectable_bases) { if (((base->flag & BASE_SELECTED) == 0) && - (compare_v3v3(base->object->color, ob->color, 0.005f))) { + compare_v3v3(base->object->color, ob->color, 0.005f)) { ED_object_base_select(base, BA_SELECT); changed = true; } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 99e42710b49..761a6702c6f 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3118,9 +3118,8 @@ static void subdivide_particle(PEData *data, int pa_index) pa->flag |= PARS_REKEY; - nkey = new_keys = MEM_callocN((pa->totkey + totnewkey) * (sizeof(HairKey)), - "Hair subdivide keys"); - nekey = new_ekeys = MEM_callocN((pa->totkey + totnewkey) * (sizeof(PTCacheEditKey)), + nkey = new_keys = MEM_callocN((pa->totkey + totnewkey) * sizeof(HairKey), "Hair subdivide keys"); + nekey = new_ekeys = MEM_callocN((pa->totkey + totnewkey) * sizeof(PTCacheEditKey), "Hair subdivide edit keys"); key = pa->hair; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 1d3cf7c36af..07e8f5c5743 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -81,51 +81,51 @@ typedef struct FluidJob { static inline bool fluid_is_bake_all(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_ALL)); + return STREQ(job->type, FLUID_JOB_BAKE_ALL); } static inline bool fluid_is_bake_data(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_DATA)); + return STREQ(job->type, FLUID_JOB_BAKE_DATA); } static inline bool fluid_is_bake_noise(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_NOISE)); + return STREQ(job->type, FLUID_JOB_BAKE_NOISE); } static inline bool fluid_is_bake_mesh(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_MESH)); + return STREQ(job->type, FLUID_JOB_BAKE_MESH); } static inline bool fluid_is_bake_particle(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_PARTICLES)); + return STREQ(job->type, FLUID_JOB_BAKE_PARTICLES); } static inline bool fluid_is_bake_guiding(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_BAKE_GUIDES)); + return STREQ(job->type, FLUID_JOB_BAKE_GUIDES); } static inline bool fluid_is_free_all(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_ALL)); + return STREQ(job->type, FLUID_JOB_FREE_ALL); } static inline bool fluid_is_free_data(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_DATA)); + return STREQ(job->type, FLUID_JOB_FREE_DATA); } static inline bool fluid_is_free_noise(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_NOISE)); + return STREQ(job->type, FLUID_JOB_FREE_NOISE); } static inline bool fluid_is_free_mesh(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_MESH)); + return STREQ(job->type, FLUID_JOB_FREE_MESH); } static inline bool fluid_is_free_particles(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_PARTICLES)); + return STREQ(job->type, FLUID_JOB_FREE_PARTICLES); } static inline bool fluid_is_free_guiding(FluidJob *job) { - return (STREQ(job->type, FLUID_JOB_FREE_GUIDES)); + return STREQ(job->type, FLUID_JOB_FREE_GUIDES); } static bool fluid_initjob( diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index bc7006d2ac7..f06e2bd4f3c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1641,7 +1641,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) spacetype = area->spacetype; } - sad->from_anim_edit = (ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)); + sad->from_anim_edit = ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA); screen->animtimer->customdata = sad; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e04cf5c6d68..6a910170e44 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -241,7 +241,7 @@ bool ED_operator_animview_active(bContext *C) { if (ED_operator_areaactive(C)) { SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C); - if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH))) { + if (sl && ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)) { return true; } } @@ -834,8 +834,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const b az->alpha = 1.0f; } else if (mouse_sq < fadeout_sq) { - az->alpha = 1.0f - - ((float)(mouse_sq - fadein_sq)) / ((float)(fadeout_sq - fadein_sq)); + az->alpha = 1.0f - (float)(mouse_sq - fadein_sq) / (float)(fadeout_sq - fadein_sq); } else { az->alpha = 0.0f; @@ -2277,8 +2276,8 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) } /* The factor will be close to 1.0f when near the top-left and the bottom-right corners. */ - const float factor_v = ((float)(event->xy[1] - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy; - const float factor_h = ((float)(event->xy[0] - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx; + const float factor_v = (float)(event->xy[1] - sad->sa1->v1->vec.y) / (float)sad->sa1->winy; + const float factor_h = (float)(event->xy[0] - sad->sa1->v1->vec.x) / (float)sad->sa1->winx; const bool is_left = factor_v < 0.5f; const bool is_bottom = factor_h < 0.5f; const bool is_right = !is_left; @@ -2316,11 +2315,11 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) dir_axis = RNA_property_enum_get(op->ptr, prop_dir); if (dir_axis == SCREEN_AXIS_H) { RNA_property_float_set( - op->ptr, prop_factor, ((float)(event->xy[0] - area->v1->vec.x)) / (float)area->winx); + op->ptr, prop_factor, (float)(event->xy[0] - area->v1->vec.x) / (float)area->winx); } else { RNA_property_float_set( - op->ptr, prop_factor, ((float)(event->xy[1] - area->v1->vec.y)) / (float)area->winy); + op->ptr, prop_factor, (float)(event->xy[1] - area->v1->vec.y) / (float)area->winy); } if (!area_split_init(C, op)) { @@ -4503,7 +4502,7 @@ static void screen_animation_region_tag_redraw( { /* Do follow time here if editor type supports it */ if ((redraws & TIME_FOLLOW) && - (screen_animation_region_supports_time_follow(area->spacetype, region->regiontype))) { + screen_animation_region_supports_time_follow(area->spacetype, region->regiontype)) { float w = BLI_rctf_size_x(®ion->v2d.cur); if (scene->r.cfra < region->v2d.cur.xmin) { region->v2d.cur.xmax = scene->r.cfra; @@ -4842,11 +4841,11 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) static int screen_animation_play_exec(bContext *C, wmOperator *op) { - int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; + int mode = RNA_boolean_get(op->ptr, "reverse") ? -1 : 1; int sync = -1; if (RNA_struct_property_is_set(op->ptr, "sync")) { - sync = (RNA_boolean_get(op->ptr, "sync")); + sync = RNA_boolean_get(op->ptr, "sync"); } return ED_screen_animation_play(C, sync, mode); diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c index 01c208bf48d..a7ef40361ea 100644 --- a/source/blender/editors/screen/screen_user_menu.c +++ b/source/blender/editors/screen/screen_user_menu.c @@ -103,7 +103,7 @@ bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(ListBase *lb, if (umi->type == USER_MENU_TYPE_OPERATOR) { bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi; if (STREQ(ot->idname, umi_op->op_idname) && (opcontext == umi_op->opcontext) && - (IDP_EqualsProperties(prop, umi_op->prop))) { + IDP_EqualsProperties(prop, umi_op->prop)) { return umi_op; } } diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index d46397180c5..569d6c2793c 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -196,7 +196,7 @@ static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), { const char *prop_id = RNA_property_identifier(prop); - return !(STREQ(prop_id, "filepath")); + return !STREQ(prop_id, "filepath"); } static void screenshot_draw(bContext *UNUSED(C), wmOperator *op) diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index d5379a4cfcd..71ec444098e 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1088,7 +1088,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, float location[3], symm_rot_mat[4][4]; for (int i = 0; i <= symm; i++) { - if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (!ELEM(i, 3, 5))))) { + if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || !ELEM(i, 3, 5)))) { /* Axis Symmetry. */ flip_v3_v3(location, true_location, (char)i); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 66132fe4b92..8ffa78cd457 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -592,8 +592,8 @@ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[ * * Second multiplication does similar but for vertical offset */ - return ((int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x)) + - (((int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y)) * + return (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + + ((int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) * ps->buckets_x); } @@ -1942,8 +1942,8 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, } /* which bounding box cell are we in?, needed for undo */ - projPixel->bb_cell_index = ((int)(((float)x_px / (float)ibuf->x) * PROJ_BOUNDBOX_DIV)) + - ((int)(((float)y_px / (float)ibuf->y) * PROJ_BOUNDBOX_DIV)) * + projPixel->bb_cell_index = (int)(((float)x_px / (float)ibuf->x) * PROJ_BOUNDBOX_DIV) + + (int)(((float)y_px / (float)ibuf->y) * PROJ_BOUNDBOX_DIV) * PROJ_BOUNDBOX_DIV; /* done with view3d_project_float inline */ @@ -2412,7 +2412,7 @@ static bool IsectPT2Df_limit( const float pt[2], const float v1[2], const float v2[2], const float v3[2], const float limit) { return ((area_tri_v2(pt, v1, v2) + area_tri_v2(pt, v2, v3) + area_tri_v2(pt, v3, v1)) / - (area_tri_v2(v1, v2, v3))) < limit; + area_tri_v2(v1, v2, v3)) < limit; } /** diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc index b2ca7268cb6..6e3504332ed 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex.cc @@ -4102,7 +4102,7 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay BMLoop *l = f->l_first; do { - if (!(use_vert_sel && !(BM_elem_flag_test(l->v, BM_ELEM_SELECT)))) { + if (!(use_vert_sel && !BM_elem_flag_test(l->v, BM_ELEM_SELECT))) { if constexpr (domain == ATTR_DOMAIN_CORNER) { color = static_cast<Color *>(BM_ELEM_CD_GET_VOID_P(l, cd_offset)); } diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc index c2b60f1d2d1..09374422888 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc @@ -73,7 +73,7 @@ static bool vertex_paint_from_weight(Object *ob) using namespace blender; Mesh *me; - if ((me = BKE_mesh_from_object(ob)) == nullptr || (ED_mesh_color_ensure(me, nullptr)) == false) { + if ((me = BKE_mesh_from_object(ob)) == nullptr || ED_mesh_color_ensure(me, nullptr) == false) { return false; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index a71358f4925..9e1b1cda0c3 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1089,7 +1089,7 @@ PBVHVertRef SCULPT_nearest_vertex_get( bool SCULPT_is_symmetry_iteration_valid(char i, char symm) { - return i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (!ELEM(i, 3, 5)))); + return i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || !ELEM(i, 3, 5))); } bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3], @@ -3024,7 +3024,7 @@ void SCULPT_calc_brush_plane( } /* For area normal. */ - if ((!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) && + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) && (brush->flag & BRUSH_ORIGINAL_NORMAL)) { copy_v3_v3(r_area_no, ss->cache->sculpt_normal); } @@ -3033,7 +3033,7 @@ void SCULPT_calc_brush_plane( } /* For flatten center. */ - if ((!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) && + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) && (brush->flag & BRUSH_ORIGINAL_PLANE)) { copy_v3_v3(r_area_co, ss->cache->last_center); } @@ -5204,7 +5204,7 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob) /* Restore the mesh before continuing with anchored stroke. */ if ((brush->flag & BRUSH_ANCHORED) || - ((ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ELASTIC_DEFORM)) && + (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ELASTIC_DEFORM) && BKE_brush_use_size_pressure(brush)) || (brush->flag & BRUSH_DRAG_DOT)) { diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc index ea8cde9312a..5a0fcd8bc27 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc @@ -521,7 +521,7 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking, } uchar stroke_id = ss->attrs.automasking_stroke_id ? - *(uchar *)(SCULPT_vertex_attr_get(vert, ss->attrs.automasking_stroke_id)) : + *(uchar *)SCULPT_vertex_attr_get(vert, ss->attrs.automasking_stroke_id) : -1; bool do_occlusion = (automasking->settings.flags & diff --git a/source/blender/editors/sculpt_paint/sculpt_brush_types.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c index 7c4fffb67b0..041efbb357c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_brush_types.c +++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c @@ -131,7 +131,7 @@ static void calc_sculpt_plane( } /* For area normal. */ - if ((!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) && + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) && (brush->flag & BRUSH_ORIGINAL_NORMAL)) { copy_v3_v3(r_area_no, ss->cache->sculpt_normal); } @@ -140,7 +140,7 @@ static void calc_sculpt_plane( } /* For flatten center. */ - if ((!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) && + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) && (brush->flag & BRUSH_ORIGINAL_PLANE)) { copy_v3_v3(r_area_co, ss->cache->last_center); } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index c15fcc634dd..c5f457b3fd8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -228,53 +228,53 @@ static bool buttons_context_path_data(ButsContextPath *path, int type) PointerRNA *ptr = &path->ptr[path->len - 1]; /* if we already have a data, we're done */ - if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (ELEM(type, -1, OB_MESH))) { + if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && ELEM(type, -1, OB_MESH)) { return true; } if (RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM(type, OB_CURVES_LEGACY, OB_SURF, OB_FONT))) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (ELEM(type, -1, OB_ARMATURE))) { + if (RNA_struct_is_a(ptr->type, &RNA_Armature) && ELEM(type, -1, OB_ARMATURE)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (ELEM(type, -1, OB_MBALL))) { + if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && ELEM(type, -1, OB_MBALL)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (ELEM(type, -1, OB_LATTICE))) { + if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && ELEM(type, -1, OB_LATTICE)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (ELEM(type, -1, OB_CAMERA))) { + if (RNA_struct_is_a(ptr->type, &RNA_Camera) && ELEM(type, -1, OB_CAMERA)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Light) && (ELEM(type, -1, OB_LAMP))) { + if (RNA_struct_is_a(ptr->type, &RNA_Light) && ELEM(type, -1, OB_LAMP)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (ELEM(type, -1, OB_SPEAKER))) { + if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && ELEM(type, -1, OB_SPEAKER)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (ELEM(type, -1, OB_LIGHTPROBE))) { + if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && ELEM(type, -1, OB_LIGHTPROBE)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (ELEM(type, -1, OB_GPENCIL))) { + if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && ELEM(type, -1, OB_GPENCIL)) { return true; } - if (RNA_struct_is_a(ptr->type, &RNA_Curves) && (ELEM(type, -1, OB_CURVES))) { + if (RNA_struct_is_a(ptr->type, &RNA_Curves) && ELEM(type, -1, OB_CURVES)) { return true; } #ifdef WITH_POINT_CLOUD - if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (ELEM(type, -1, OB_POINTCLOUD))) { + if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && ELEM(type, -1, OB_POINTCLOUD)) { return true; } #endif - if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (ELEM(type, -1, OB_VOLUME))) { + if (RNA_struct_is_a(ptr->type, &RNA_Volume) && ELEM(type, -1, OB_VOLUME)) { return true; } /* try to get an object in the path, no pinning supported here */ if (buttons_context_path_object(path)) { Object *ob = path->ptr[path->len - 1].data; - if (ob && (ELEM(type, -1, ob->type))) { + if (ob && ELEM(type, -1, ob->type)) { RNA_id_pointer_create(ob->data, &path->ptr[path->len]); path->len++; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index d4e456272f9..8b04398c559 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -179,7 +179,7 @@ static void buttons_texture_modifier_geonodes_users_add(Object *ob, prop = RNA_struct_find_property(&ptr, "default_value"); PointerRNA texptr = RNA_property_pointer_get(&ptr, prop); - Tex *tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? (Tex *)texptr.data : NULL; + Tex *tex = RNA_struct_is_a(texptr.type, &RNA_Texture) ? (Tex *)texptr.data : NULL; if (tex != NULL) { buttons_texture_user_socket_property_add(users, &ob->id, @@ -414,7 +414,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts) /* Get texture datablock pointer if it's a property. */ texptr = RNA_property_pointer_get(&ct->user->ptr, ct->user->prop); - tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL; + tex = RNA_struct_is_a(texptr.type, &RNA_Texture) ? texptr.data : NULL; ct->texture = tex; } @@ -449,7 +449,7 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg) } if (user->ptr.data) { texptr = RNA_property_pointer_get(&user->ptr, user->prop); - tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL; + tex = RNA_struct_is_a(texptr.type, &RNA_Texture) ? texptr.data : NULL; ct->texture = tex; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 0f5207b39c2..49725a26562 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1847,7 +1847,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op) if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) { bool ok; - ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) && + ok = is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT) && ((error == 0.0f) || (track->flag & TRACK_HAS_BUNDLE) == 0 || (track->error < error)); if (!ok) { diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 93eb5938301..554b628ba0f 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -971,7 +971,7 @@ void file_draw_list(const bContext *C, ARegion *region) UI_draw_roundbox_corner_set(UI_CNR_NONE); /* don't drag parent or refresh items */ - do_drag = !(FILENAME_IS_CURRPAR(file->relpath)); + do_drag = !FILENAME_IS_CURRPAR(file->relpath); const bool is_hidden = (file->attributes & FILE_ATTR_HIDDEN); const bool is_link = (file->attributes & FILE_ATTR_ANY_LINK); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 93aa5cf992d..9ebc4872544 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -695,14 +695,14 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *region) */ if (layout->flag & FILE_LAYOUT_HOR) { const int x_item = layout->tile_w + (2 * layout->tile_border_x); - const int x_view = (int)(BLI_rctf_size_x(®ion->v2d.cur)); + const int x_view = (int)BLI_rctf_size_x(®ion->v2d.cur); const int x_over = x_item - (x_view % x_item); numfiles = (int)((float)(x_view + x_over) / (float)(x_item)); return numfiles * layout->rows; } const int y_item = layout->tile_h + (2 * layout->tile_border_y); - const int y_view = (int)(BLI_rctf_size_y(®ion->v2d.cur)) - layout->offset_top; + const int y_view = (int)BLI_rctf_size_y(®ion->v2d.cur) - layout->offset_top; const int y_over = y_item - (y_view % y_item); numfiles = (int)((float)(y_view + y_over) / (float)(y_item)); return numfiles * layout->flow_columns; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index cab491fb8d2..a23b33dde95 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1771,7 +1771,7 @@ static ListBase /*tEulerFilter*/ euler_filter_group_channels( * so if the paths or the ID's don't match up, then a curve needs to be added * to a new group. */ - if ((euf) && (euf->id == ale->id) && (STREQ(euf->rna_path, fcu->rna_path))) { + if ((euf) && (euf->id == ale->id) && STREQ(euf->rna_path, fcu->rna_path)) { /* This should be fine to add to the existing group then. */ euf->fcurves[fcu->array_index] = fcu; continue; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 98e555c7f77..c8efee504b4 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -654,7 +654,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, /* view */ if (BLI_listbase_count_at_most(&rr->views, 2) > 1 && - ((!show_stereo) || (!RE_RenderResult_is_stereo(rr)))) { + ((!show_stereo) || !RE_RenderResult_is_stereo(rr))) { rview = BLI_findlink(&rr->views, iuser->view); display_name = rview ? rview->name : ""; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 09bb895cffb..42ebed6ec3a 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -572,15 +572,15 @@ void draw_image_cache(const bContext *C, ARegion *region) float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension) { /* UV-space length per pixel */ - float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin)); - float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin)); + float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / (float)(v2d->mask.xmax - v2d->mask.xmin); + float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / (float)(v2d->mask.ymax - v2d->mask.ymin); /* Zoom_factor for UV/Image editor is calculated based on: * - Default grid size on startup, which is 256x256 pixels * - How blend factor for grid lines is set up in the fragment shader `grid_frag.glsl`. */ float zoom_factor; zoom_factor = (xzoom + yzoom) / 2.0f; /* Average for accuracy. */ - zoom_factor *= 256.0f / (powf(grid_dimension, 2)); + zoom_factor *= 256.0f / powf(grid_dimension, 2); return zoom_factor; } diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index c1ac5b7e7ef..0122e509c3b 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -408,7 +408,7 @@ void ED_space_image_scopes_update(const struct bContext *C, /* We also don't update scopes of render result during render. */ if (G.is_rendering) { const Image *image = sima->image; - if (image != NULL && (ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE))) { + if (image != NULL && ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { return; } } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 93e41589881..bb47ad5c6c0 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1485,7 +1485,7 @@ static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr), { const char *prop_id = RNA_property_identifier(prop); - return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); + return !STR_ELEM(prop_id, "filepath", "directory", "filename"); } static void image_open_draw(bContext *UNUSED(C), wmOperator *op) diff --git a/source/blender/editors/space_image/image_sequence.c b/source/blender/editors/space_image/image_sequence.c index fbeef47e278..7108c258665 100644 --- a/source/blender/editors/space_image/image_sequence.c +++ b/source/blender/editors/space_image/image_sequence.c @@ -58,8 +58,8 @@ static void image_sequence_get_frame_ranges(wmOperator *op, ListBase *ranges) frame->framenr = BLI_path_sequence_decode(filename, head, tail, &digits); /* still in the same sequence */ - if (do_frame_range && (range != NULL) && (STREQLEN(base_head, head, FILE_MAX)) && - (STREQLEN(base_tail, tail, FILE_MAX))) { + if (do_frame_range && (range != NULL) && STREQLEN(base_head, head, FILE_MAX) && + STREQLEN(base_tail, tail, FILE_MAX)) { /* Set filepath to first frame in the range. */ if (frame->framenr < range_first_frame) { BLI_join_dirfile(range->filepath, sizeof(range->filepath), dir, filename); diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index 81fa5cc2303..cac0dbb0067 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -624,7 +624,7 @@ static const char *info_statusbar_string(Main *bmain, } /* GPU VRAM status. */ - if ((statusbar_flag & STATUSBAR_SHOW_VRAM) && (GPU_mem_stats_supported())) { + if ((statusbar_flag & STATUSBAR_SHOW_VRAM) && GPU_mem_stats_supported()) { int gpu_free_mem_kb, gpu_tot_mem_kb; GPU_mem_stats_get(&gpu_tot_mem_kb, &gpu_free_mem_kb); float gpu_total_gb = gpu_tot_mem_kb / 1048576.0f; diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index acfbb7a8ae4..8a1119d5e66 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -3362,7 +3362,7 @@ static void outliner_draw_tree_element(bContext *C, offsx += UI_UNIT_X; /* Data-type icon. */ - if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE)) && + if (!ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE) && tselem_draw_icon(block, xmax, float(startx) + offsx, diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 21d44cb5d58..6eca6fffece 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -239,7 +239,7 @@ static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmE TreeStoreElem *tselem = TREESTORE(te); const bool open = (tselem->flag & TSE_CLOSED) || - (toggle_all && (outliner_flag_is_any_test(&te->subtree, TSE_CLOSED, 1))); + (toggle_all && outliner_flag_is_any_test(&te->subtree, TSE_CLOSED, 1)); outliner_item_openclose(te, open, toggle_all); outliner_tag_redraw_avoid_rebuild_on_open_change(space_outliner, region); diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index 8e7bd07e987..235dc3afa5f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -1598,7 +1598,7 @@ static int outliner_filter_subtree(SpaceOutliner *space_outliner, /* flag as not a found item */ tselem->flag &= ~TSE_SEARCHMATCH; - if ((!TSELEM_OPEN(tselem, space_outliner)) || + if (!TSELEM_OPEN(tselem, space_outliner) || outliner_filter_subtree( space_outliner, scene, view_layer, &te->subtree, search_string, exclude_filter) == 0) { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 719332046b3..6ef8d7fd108 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -201,7 +201,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) for (seq = ed->seqbasep->first; seq; seq = seq->next) { const int strip_end = SEQ_time_right_handle_frame_get(scene, seq); - if ((ELEM(type, -1, seq->type)) && (strip_end < timeline_frame) && + if (ELEM(type, -1, seq->type) && (strip_end < timeline_frame) && (timeline_frame - strip_end < proximity)) { tgt = seq; proximity = timeline_frame - strip_end; @@ -399,7 +399,7 @@ static bool seq_effect_add_properties_poll(const bContext *UNUSED(C), return false; } } - if ((type != SEQ_TYPE_COLOR) && (STREQ(prop_id, "color"))) { + if ((type != SEQ_TYPE_COLOR) && STREQ(prop_id, "color")) { return false; } @@ -747,7 +747,7 @@ static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr), { const char *prop_id = RNA_property_identifier(prop); - return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); + return !STR_ELEM(prop_id, "filepath", "directory", "filename"); } /* Strips are added in context of timeline which has different preview size than actual preview. We diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 77255c965a7..201425dafab 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1371,7 +1371,7 @@ static void draw_seq_strip(const bContext *C, if ((sseq->flag & SEQ_SHOW_OVERLAY) && (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_THUMBNAILS) && - (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE))) { + ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { draw_seq_strip_thumbnail( v2d, C, scene, seq, y1, y_threshold ? text_margin_y : y2, pixelx, pixely); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 415bb5898a9..2938513f130 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -120,7 +120,7 @@ bool ED_space_sequencer_maskedit_poll(bContext *C) bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq) { return (sseq->mainb == SEQ_DRAW_IMG_IMBUF) && - (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)); + ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW); } bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq) @@ -194,7 +194,7 @@ bool sequencer_strip_has_path_poll(bContext *C) Editing *ed; Sequence *seq; return (((ed = SEQ_editing_get(CTX_data_scene(C))) != NULL) && ((seq = ed->act_seq) != NULL) && - (SEQ_HAS_PATH(seq))); + SEQ_HAS_PATH(seq)); } bool sequencer_view_has_preview_poll(bContext *C) diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index fde8bc16f6b..7f7e9878dd6 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -117,13 +117,13 @@ static void select_active_side( if (channel == seq->machine) { switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > (SEQ_time_left_handle_frame_get(scene, seq))) { + if (frame > SEQ_time_left_handle_frame_get(scene, seq)) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < (SEQ_time_left_handle_frame_get(scene, seq))) { + if (frame < SEQ_time_left_handle_frame_get(scene, seq)) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } @@ -154,13 +154,13 @@ static void select_active_side_range(const Scene *scene, } switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > (SEQ_time_left_handle_frame_get(scene, seq))) { + if (frame > SEQ_time_left_handle_frame_get(scene, seq)) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < (SEQ_time_left_handle_frame_get(scene, seq))) { + if (frame < SEQ_time_left_handle_frame_get(scene, seq)) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } @@ -276,13 +276,13 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se switch (lr) { case SEQ_SIDE_LEFT: if (SEQ_time_left_handle_frame_get(scene, test) == - (SEQ_time_right_handle_frame_get(scene, seq))) { + SEQ_time_right_handle_frame_get(scene, seq)) { return seq; } break; case SEQ_SIDE_RIGHT: if (SEQ_time_right_handle_frame_get(scene, test) == - (SEQ_time_left_handle_frame_get(scene, seq))) { + SEQ_time_left_handle_frame_get(scene, seq)) { return seq; } break; @@ -1815,7 +1815,7 @@ static const EnumPropertyItem sequencer_prop_select_grouped_types[] = { #define SEQ_USE_DATA(_seq) \ (ELEM(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq)) -#define SEQ_CHANNEL_CHECK(_seq, _chan) (ELEM((_chan), 0, (_seq)->machine)) +#define SEQ_CHANNEL_CHECK(_seq, _chan) ELEM((_chan), 0, (_seq)->machine) static bool select_grouped_type(SeqCollection *strips, ListBase *UNUSED(seqbase), diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 461606f63aa..db4fc7da9dc 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -162,13 +162,13 @@ static GHash *text_autocomplete_build(Text *text) /* seek identifier beginning */ i_pos = i_start; while ((i_start < linep->len) && - (!text_check_identifier_nodigit_unicode( - BLI_str_utf8_as_unicode_step(linep->line, linep->len, &i_pos)))) { + !text_check_identifier_nodigit_unicode( + BLI_str_utf8_as_unicode_step(linep->line, linep->len, &i_pos))) { i_start = i_pos; } i_pos = i_end = i_start; - while ((i_end < linep->len) && (text_check_identifier_unicode(BLI_str_utf8_as_unicode_step( - linep->line, linep->len, &i_pos)))) { + while ((i_end < linep->len) && text_check_identifier_unicode(BLI_str_utf8_as_unicode_step( + linep->line, linep->len, &i_pos))) { i_end = i_pos; } diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index 28f536ffa98..6aff8c7b966 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -226,7 +226,7 @@ static uint txtfmt_py_numeral_string_count_hexadecimal(const char *string) /* Zeros. */ static bool txtfmt_py_numeral_char_is_zero(const char c) { - return (ELEM(c, '0', '_')); + return ELEM(c, '0', '_'); } static uint txtfmt_py_numeral_string_count_zeros(const char *string) { diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index b783b67357c..4153f19f8be 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1821,7 +1821,7 @@ static int view3d_object_mode_menu(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "No active object found"); return OPERATOR_CANCELLED; } - if (((ob->mode & OB_MODE_EDIT) == 0) && (ELEM(ob->type, OB_ARMATURE))) { + if (((ob->mode & OB_MODE_EDIT) == 0) && ELEM(ob->type, OB_ARMATURE)) { ED_object_mode_set(C, (ob->mode == OB_MODE_OBJECT) ? OB_MODE_POSE : OB_MODE_OBJECT); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c index df653f9a6e5..4401dbf7935 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_light.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c @@ -255,7 +255,7 @@ static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *U Object *ob = base->object; if (ob->type == OB_LAMP) { Light *la = ob->data; - return (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA)); + return ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA); } #if 0 else if (ob->type == OB_CAMERA) { diff --git a/source/blender/editors/space_view3d/view3d_navigate_ndof.c b/source/blender/editors/space_view3d/view3d_navigate_ndof.c index 893c9008f23..29e63a72daf 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_ndof.c +++ b/source/blender/editors/space_view3d/view3d_navigate_ndof.c @@ -32,7 +32,7 @@ static bool ndof_has_translate(const wmNDOFMotionData *ndof, const View3D *v3d, const RegionView3D *rv3d) { - return !is_zero_v3(ndof->tvec) && (!ED_view3d_offset_lock_check(v3d, rv3d)); + return !is_zero_v3(ndof->tvec) && !ED_view3d_offset_lock_check(v3d, rv3d); } static bool ndof_has_rotate(const wmNDOFMotionData *ndof, const RegionView3D *rv3d) diff --git a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c index 7cafc3dfd42..fe83bbb7c59 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c +++ b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c @@ -96,8 +96,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } /* convert border to 3d coordinates */ - if ((!ED_view3d_unproject_v3(region, cent[0], cent[1], depth_close, p)) || - (!ED_view3d_unproject_v3(region, rect.xmin, rect.ymin, depth_close, p_corner))) { + if (!ED_view3d_unproject_v3(region, cent[0], cent[1], depth_close, p) || + !ED_view3d_unproject_v3(region, rect.xmin, rect.ymin, depth_close, p_corner)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index a5ecef69ff8..ee6b1886dc2 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -388,7 +388,7 @@ static bool snap_selected_to_location(bContext *C, mul_v3_m4v3(snap_target_local, ob->imat, snap_target_global); for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { - if ((pchan->bone->flag & BONE_SELECTED) && (PBONE_VISIBLE(arm, pchan->bone)) && + if ((pchan->bone->flag & BONE_SELECTED) && PBONE_VISIBLE(arm, pchan->bone) && /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. */ diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index cb716391fb2..1fc16939f3f 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -271,8 +271,8 @@ void ED_view3d_clipping_calc( /* four clipping planes and bounding volume */ /* first do the bounding volume */ for (int val = 0; val < 4; val++) { - float xs = (ELEM(val, 0, 3)) ? rect->xmin : rect->xmax; - float ys = (ELEM(val, 0, 1)) ? rect->ymin : rect->ymax; + float xs = ELEM(val, 0, 3) ? rect->xmin : rect->xmax; + float ys = ELEM(val, 0, 1) ? rect->ymin : rect->ymax; ED_view3d_unproject_v3(region, xs, ys, 0.0, bb->vec[val]); ED_view3d_unproject_v3(region, xs, ys, 1.0, bb->vec[4 + val]); @@ -544,7 +544,7 @@ bool ED_view3d_camera_view_pan(ARegion *region, const float event_ofs[2]) bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d) { - return ((v3d->camera) && (!ID_IS_LINKED(v3d->camera)) && (v3d->flag2 & V3D_LOCK_CAMERA) && + return ((v3d->camera) && !ID_IS_LINKED(v3d->camera) && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp == RV3D_CAMOB)); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a0934ae27aa..6f7eb317b42 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -67,7 +67,7 @@ bool transdata_check_local_islands(TransInfo *t, short around) if (t->options & (CTX_CURSOR | CTX_TEXTURE_SPACE)) { return false; } - return ((around == V3D_AROUND_LOCAL_ORIGINS) && (ELEM(t->obedit_type, OB_MESH, OB_GPENCIL))); + return ((around == V3D_AROUND_LOCAL_ORIGINS) && ELEM(t->obedit_type, OB_MESH, OB_GPENCIL)); } /* ************************** SPACE DEPENDENT CODE **************************** */ @@ -2075,7 +2075,7 @@ bool checkUseAxisMatrix(TransInfo *t) /* currently only checks for editmode */ if (t->flag & T_EDIT) { if ((t->around == V3D_AROUND_LOCAL_ORIGINS) && - (ELEM(t->obedit_type, OB_MESH, OB_CURVES_LEGACY, OB_MBALL, OB_ARMATURE))) { + ELEM(t->obedit_type, OB_MESH, OB_CURVES_LEGACY, OB_MBALL, OB_ARMATURE)) { /* not all editmode supports axis-matrix */ return true; } diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 1e29411fe84..7a68ee1bfbf 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -1115,11 +1115,11 @@ static TransConvertTypeInfo *convert_type_get(const TransInfo *t, Object **r_obj } return NULL; } - if ((ob) && (ELEM(ob->mode, - OB_MODE_PAINT_GPENCIL, - OB_MODE_SCULPT_GPENCIL, - OB_MODE_WEIGHT_GPENCIL, - OB_MODE_VERTEX_GPENCIL))) { + if (ob && ELEM(ob->mode, + OB_MODE_PAINT_GPENCIL, + OB_MODE_SCULPT_GPENCIL, + OB_MODE_WEIGHT_GPENCIL, + OB_MODE_VERTEX_GPENCIL)) { /* In grease pencil all transformations must be canceled if not Object or Edit. */ return NULL; } diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index d83cca15219..4b79625fa66 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -1506,7 +1506,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED)) { bone->flag |= BONE_HINGE_CHILD_TRANSFORM; } - else if ((bone->flag & BONE_TRANSFORM) && (ELEM(mode, TFM_ROTATION, TFM_TRACKBALL)) && + else if ((bone->flag & BONE_TRANSFORM) && ELEM(mode, TFM_ROTATION, TFM_TRACKBALL) && (around == V3D_AROUND_LOCAL_ORIGINS)) { bone->flag |= BONE_TRANSFORM_CHILD; } diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index b3d58f25ad3..8c23f3c2b96 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -750,7 +750,7 @@ static void recalcData_gpencil_strokes(TransInfo *t) for (int i = 0; i < tc->data_len; i++, td++) { bGPDstroke *gps = td->extra; - if ((gps != NULL) && (!BLI_ghash_haskey(strokes, gps))) { + if ((gps != NULL) && !BLI_ghash_haskey(strokes, gps)) { BLI_ghash_insert(strokes, gps, gps); if (is_curve_edit && gps->editcurve != NULL) { BKE_gpencil_editcurve_recalculate_handles(gps); diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index f67a44703e5..af7982f862a 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1423,8 +1423,7 @@ static void VertsToTransData(TransInfo *t, copy_v3_v3(td->iloc, td->loc); if ((t->mode == TFM_SHRINKFATTEN) && (em->selectmode & SCE_SELECT_FACE) && - BM_elem_flag_test(eve, BM_ELEM_SELECT) && - (BM_vert_calc_normal_ex(eve, BM_ELEM_SELECT, _no))) { + BM_elem_flag_test(eve, BM_ELEM_SELECT) && BM_vert_calc_normal_ex(eve, BM_ELEM_SELECT, _no)) { no = _no; } else { diff --git a/source/blender/editors/transform/transform_convert_object.c b/source/blender/editors/transform/transform_convert_object.c index c82364ba7ba..0dcfd7206ad 100644 --- a/source/blender/editors/transform/transform_convert_object.c +++ b/source/blender/editors/transform/transform_convert_object.c @@ -383,7 +383,7 @@ static void set_trans_object_base_flags(TransInfo *t) if (parsel != NULL) { /* Rotation around local centers are allowed to propagate. */ if ((t->around == V3D_AROUND_LOCAL_ORIGINS) && - (ELEM(t->mode, TFM_ROTATION, TFM_TRACKBALL))) { + ELEM(t->mode, TFM_ROTATION, TFM_TRACKBALL)) { base->flag_legacy |= BA_TRANSFORM_CHILD; } else { @@ -427,7 +427,7 @@ static int count_proportional_objects(TransInfo *t) /* Clear all flags we need. It will be used to detect dependencies. */ trans_object_base_deps_flag_prepare(scene, view_layer); /* Rotations around local centers are allowed to propagate, so we take all objects. */ - if (!((t->around == V3D_AROUND_LOCAL_ORIGINS) && (ELEM(t->mode, TFM_ROTATION, TFM_TRACKBALL)))) { + if (!((t->around == V3D_AROUND_LOCAL_ORIGINS) && ELEM(t->mode, TFM_ROTATION, TFM_TRACKBALL))) { /* Mark all parents. */ LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { if (BASE_SELECTED_EDITABLE(v3d, base) && BASE_SELECTABLE(v3d, base)) { diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 6591574323e..f3d17559a63 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -553,7 +553,7 @@ static void axis_angle_to_gimbal_axis(float gmat[3][3], const float axis[3], con static bool test_rotmode_euler(short rotmode) { - return (ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) ? 0 : 1; + return ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT) ? 0 : 1; } bool gimbal_axis_pose(Object *ob, const bPoseChannel *pchan, float gmat[3][3]) diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 10ea022757d..2eaeaf92c86 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -57,7 +57,7 @@ bool transdata_check_local_center(const TransInfo *t, short around) return ((around == V3D_AROUND_LOCAL_ORIGINS) && ((t->options & (CTX_OBJECT | CTX_POSE_BONE)) || /* implicit: (t->flag & T_EDIT) */ - (ELEM(t->obedit_type, OB_MESH, OB_CURVES_LEGACY, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) || + ELEM(t->obedit_type, OB_MESH, OB_CURVES_LEGACY, OB_MBALL, OB_ARMATURE, OB_GPENCIL) || (t->spacetype == SPACE_GRAPH) || (t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE | CTX_SEQUENCER_IMAGE)))); } diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index 8a29321413e..5baf06006d9 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -954,7 +954,7 @@ static EdgeSlideData *createEdgeSlideVerts_single_side(TransInfo *t, TransDataCo BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { sv_table[i] = -1; - if ((v->e != NULL) && (BM_elem_flag_test(v, BM_ELEM_SELECT))) { + if ((v->e != NULL) && BM_elem_flag_test(v, BM_ELEM_SELECT)) { if (BM_elem_flag_test(v->e, BM_ELEM_SELECT) == 0) { TransDataEdgeSlideVert *sv; sv = &sv_array[j]; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 6a2a4ca97ad..3f9cca55138 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1683,7 +1683,7 @@ bool transform_snap_grid(TransInfo *t, float *val) return false; } - if ((!(t->tsnap.mode & SCE_SNAP_MODE_GRID)) || validSnap(t)) { + if (!(t->tsnap.mode & SCE_SNAP_MODE_GRID) || validSnap(t)) { /* Don't do grid snapping if there is a valid snap point. */ return false; } diff --git a/source/blender/editors/transform/transform_snap_animation.c b/source/blender/editors/transform/transform_snap_animation.c index e4273affdb6..fbb7c812525 100644 --- a/source/blender/editors/transform/transform_snap_animation.c +++ b/source/blender/editors/transform/transform_snap_animation.c @@ -115,7 +115,7 @@ void transform_snap_anim_flush_data(TransInfo *t, float val = td->loc[0]; float ival = td->iloc[0]; - AnimData *adt = (!ELEM(t->spacetype, SPACE_NLA, SPACE_SEQ)) ? td->extra : NULL; + AnimData *adt = !ELEM(t->spacetype, SPACE_NLA, SPACE_SEQ) ? td->extra : NULL; /* Convert frame to nla-action time (if needed) */ if (adt) { diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index ef57f9e9b33..334516bfd6c 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -318,8 +318,8 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, const Object *obedit, if (ebo->layer & arm->layer) { const bool tipsel = (ebo->flag & BONE_TIPSEL) != 0; const bool rootsel = (ebo->flag & BONE_ROOTSEL) != 0; - const bool rootok = (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && - (ebo->parent->flag & BONE_TIPSEL))); + const bool rootok = !(ebo->parent && (ebo->flag & BONE_CONNECTED) && + (ebo->parent->flag & BONE_TIPSEL)); if ((tipsel && rootsel) || (rootsel)) { /* Don't add the tip (unless mode & TM_ALL_JOINTS, for getting all joints), diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index 7af6cbe942b..78436d17203 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -628,8 +628,8 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve else { l_src = ED_uvedit_active_edge_loop_get(bm); if (l_src != NULL) { - if ((!uvedit_uv_select_test(scene, l_src, cd_loop_uv_offset)) && - (!uvedit_uv_select_test(scene, l_src->next, cd_loop_uv_offset))) { + if (!uvedit_uv_select_test(scene, l_src, cd_loop_uv_offset) && + !uvedit_uv_select_test(scene, l_src->next, cd_loop_uv_offset)) { l_src = NULL; } ele_src = (BMElem *)l_src; diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 6c8fb9360bd..7dd223a9252 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -228,7 +228,7 @@ bool uvedit_face_visible_test(const Scene *scene, BMFace *efa) bool uvedit_face_select_test_ex(const ToolSettings *ts, BMFace *efa, const int cd_loop_uv_offset) { if (ts->uv_flag & UV_SYNC_SELECTION) { - return (BM_elem_flag_test(efa, BM_ELEM_SELECT)); + return BM_elem_flag_test(efa, BM_ELEM_SELECT); } BMLoop *l; @@ -1549,7 +1549,7 @@ static int uv_select_edgeloop(Scene *scene, Object *obedit, UvNearestHit *hit, c const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); if (extend) { - select = !(uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset)); + select = !uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset); } else { select = true; @@ -1618,7 +1618,7 @@ static int uv_select_edgeloop(Scene *scene, Object *obedit, UvNearestHit *hit, c } } - return (select) ? 1 : -1; + return select ? 1 : -1; } /** \} */ @@ -1641,7 +1641,7 @@ static int uv_select_faceloop(Scene *scene, Object *obedit, UvNearestHit *hit, c BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false); if (extend) { - select = !(uvedit_face_select_test(scene, hit->l->f, cd_loop_uv_offset)); + select = !uvedit_face_select_test(scene, hit->l->f, cd_loop_uv_offset); } else { select = true; @@ -1710,7 +1710,7 @@ static int uv_select_edgering(Scene *scene, Object *obedit, UvNearestHit *hit, c BM_mesh_elem_hflag_disable_all(em->bm, BM_EDGE, BM_ELEM_TAG, false); if (extend) { - select = !(uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset)); + select = !uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset); } else { select = true; @@ -3636,7 +3636,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) bool has_selected = false; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) { + if (select != uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION)) { /* UV_SYNC_SELECTION - can't do pinned selection */ if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) { @@ -3856,7 +3856,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) } bool has_selected = false; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) { + if (select != uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); if (uv_circle_select_is_point_inside(luv->uv, offset, ellipse)) { changed = true; @@ -4086,7 +4086,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, } bool has_selected = false; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) { + if (select != uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); if (do_lasso_select_mesh_uv_is_point_inside( region, &rect, mcoords, mcoords_len, luv->uv)) { diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 80e58820b37..670482a23a6 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -1004,7 +1004,7 @@ NodeGroup *Controller::BuildRep(vector<ViewEdge *>::iterator vedges_begin, mat.setDiffuse(1, 1, 0.3, 1); tesselator2D.setFrsMaterial(mat); - return (tesselator2D.Tesselate(vedges_begin, vedges_end)); + return tesselator2D.Tesselate(vedges_begin, vedges_end); } void Controller::toggleEdgeTesselationNature(Nature::EdgeNature iNature) diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index 3ea83576e8f..ad9b7dfa5ed 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -45,7 +45,7 @@ static double V2SquaredLength(Vector2 *a) /* returns length of input vector */ static double V2Length(Vector2 *a) { - return (sqrt(V2SquaredLength(a))); + return sqrt(V2SquaredLength(a)); } static Vector2 *V2Scale(Vector2 *v, double newlen) @@ -69,7 +69,7 @@ static double V2DistanceBetween2Points(Vector2 *a, Vector2 *b) { double dx = (*a)[0] - (*b)[0]; double dy = (*a)[1] - (*b)[1]; - return (sqrt((dx * dx) + (dy * dy))); + return sqrt((dx * dx) + (dy * dy)); } /* return vector sum c = a+b */ diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index e0e3af0fe47..a2620aa25d7 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -36,7 +36,7 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ) // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- // first let us compute the plane equation. - Vec3r v1(((occ)->getVertices())[0]); + Vec3r v1((occ)->getVertices()[0]); Vec3d normal((occ)->getNormal()); // soc unused - double d = -(v1 * normal); diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 96bab8c2028..96887f7a83b 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -200,7 +200,7 @@ static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args ColorBand *coba; float in, out[4]; - if (!(PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in))) { + if (!PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in)) { return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_ColorRamp)) { @@ -239,7 +239,7 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject * int cur; float value; - if (!(PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value))) { + if (!PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value)) { return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_CurveMapping)) { diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index dc6592769b8..66880d6185c 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -97,7 +97,7 @@ static PyObject *Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) case Py_GT: return PyBool_from_bool(!(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id)))); case Py_GE: - return PyBool_from_bool(!(o1->id->operator<(*(o2->id)))); + return PyBool_from_bool(!o1->id->operator<(*(o2->id))); } Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index 3a6946d1668..4df0bd7b089 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -614,7 +614,7 @@ int GuidingLinesShader::shade(Stroke &stroke) const n[0] = -n[0]; n[1] = -n[1]; } - float offset = (piece.error()) / 2.0f * _offset; + float offset = piece.error() / 2.0f * _offset; StrokeInternal::StrokeVertexIterator v, vend; for (v = a, vend = stroke.strokeVerticesEnd(); v != vend; ++v) { v->setPoint(piece.A.x() + v->u() * u.x() + n.x() * offset, diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 82772ebb3a7..af79a8eb4eb 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -173,7 +173,7 @@ void Canvas::InsertStyleModule(uint index, StyleModule *iStyleModule) { uint size = _StyleModules.size(); StrokeLayer *layer = new StrokeLayer(); - if ((_StyleModules.empty()) || (index == size)) { + if (_StyleModules.empty() || (index == size)) { _StyleModules.push_back(iStyleModule); _Layers.push_back(layer); return; diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 453eea58c93..87aabf71636 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -26,7 +26,7 @@ bool AdjacencyIterator::isIncoming() const int AdjacencyIterator::increment() { ++_internalIterator; - while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) { + while (!_internalIterator.isEnd() && !isValid((*_internalIterator).first)) { ++_internalIterator; } return 0; diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index 282c72617f0..89567d7e780 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -837,11 +837,11 @@ void StrokeRep::create() bool first = true; bool end = false; while (v != vend) { - while ((v != vend) && (!(*v).attribute().isVisible())) { + while ((v != vend) && !(*v).attribute().isVisible()) { ++v; first = false; } - while ((v != vend) && ((*v).attribute().isVisible())) { + while ((v != vend) && (*v).attribute().isVisible()) { strip.push_back(&(*v)); ++v; } @@ -852,7 +852,7 @@ void StrokeRep::create() else { end = true; } - if ((!strip.empty()) && (strip.size() > 1)) { + if (!strip.empty() && (strip.size() > 1)) { _strips.push_back(new Strip(strip, _hasTex, first, end, _textureStep)); strip.clear(); } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index b94904d5efb..e455011f187 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -318,8 +318,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge) WXFace *fA = (WXFace *)iEdge->GetaOEdge()->GetaFace(); WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace(); - if ((fA->front()) ^ - (fB->front())) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1) + if (fA->front() ^ + fB->front()) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1) // The only edges we want to set as silhouette edges in this way are the ones with 2 different // normals for 1 vertex for these two faces //-------------------- @@ -627,7 +627,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) real kr(0), kr1(0), kr2(0), t; for (uint i = 0; i < vertices_nb; ++i) { - v = (WXVertex *)(iFace->GetVertex(i)); + v = (WXVertex *)iFace->GetVertex(i); // v is a singular vertex, skip it. if (v->isBoundary()) { diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index d05107dc264..2157c533986 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -203,11 +203,11 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator &iter) Interface0DIterator tmp1 = iter, tmp2 = iter; ++tmp2; uint count = 1; - while ((!tmp1.isBegin()) && (count < 3)) { + while (!tmp1.isBegin() && (count < 3)) { --tmp1; ++count; } - while ((!tmp2.isEnd()) && (count < 3)) { + while (!tmp2.isEnd() && (count < 3)) { ++tmp2; ++count; } diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index dfc5cd0af61..277334d13fd 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -350,7 +350,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) vector<WXFaceLayer *> sameNatureLayers; nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face - if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { + if (sameNatureLayers.empty() || (sameNatureLayers.size() != 1)) { return OWXFaceLayer(nullptr, true); } @@ -431,7 +431,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa vector<WXFaceLayer *> sameNatureLayers; previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face - if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { + if (sameNatureLayers.empty() || (sameNatureLayers.size() != 1)) { return OWXFaceLayer(nullptr, true); } @@ -688,23 +688,23 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) uint matA(0), matB(0); bool faceMarkA = false, faceMarkB = false; if (iwe.order) { - normalB = (iwe.e->GetbFace()->GetNormal()); - matB = (iwe.e->GetbFace()->frs_materialIndex()); - faceMarkB = (iwe.e->GetbFace()->GetMark()); + normalB = iwe.e->GetbFace()->GetNormal(); + matB = iwe.e->GetbFace()->frs_materialIndex(); + faceMarkB = iwe.e->GetbFace()->GetMark(); if (!(iwe.e->nature() & Nature::BORDER)) { - normalA = (iwe.e->GetaFace()->GetNormal()); - matA = (iwe.e->GetaFace()->frs_materialIndex()); - faceMarkA = (iwe.e->GetaFace()->GetMark()); + normalA = iwe.e->GetaFace()->GetNormal(); + matA = iwe.e->GetaFace()->frs_materialIndex(); + faceMarkA = iwe.e->GetaFace()->GetMark(); } } else { - normalA = (iwe.e->GetbFace()->GetNormal()); - matA = (iwe.e->GetbFace()->frs_materialIndex()); - faceMarkA = (iwe.e->GetbFace()->GetMark()); + normalA = iwe.e->GetbFace()->GetNormal(); + matA = iwe.e->GetbFace()->frs_materialIndex(); + faceMarkA = iwe.e->GetbFace()->GetMark(); if (!(iwe.e->nature() & Nature::BORDER)) { - normalB = (iwe.e->GetaFace()->GetNormal()); - matB = (iwe.e->GetaFace()->frs_materialIndex()); - faceMarkB = (iwe.e->GetaFace()->GetMark()); + normalB = iwe.e->GetaFace()->GetNormal(); + matB = iwe.e->GetaFace()->frs_materialIndex(); + faceMarkB = iwe.e->GetaFace()->GetMark(); } } // Creates the corresponding feature edge diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 34eae2ab47e..0ba4850eed5 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -770,7 +770,7 @@ ViewShape::~ViewShape() { _Vertices.clear(); - if (!(_Edges.empty())) { + if (!_Edges.empty()) { for (vector<ViewEdge *>::iterator e = _Edges.begin(), eend = _Edges.end(); e != eend; e++) { delete (*e); } diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 024a6a82b72..4ef06c0ac96 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -73,7 +73,7 @@ static void findOccludee(FEdge *fe, #endif oface = occluders.getWFace(); Polygon3r *p = occluders.getCameraSpacePolygon(); - real d = -((p->getVertices())[0] * p->getNormal()); + real d = -(p->getVertices()[0] * p->getNormal()); real t, t_u, t_v; if (nullptr != face) { @@ -286,7 +286,7 @@ static int computeVisibility(ViewMap *viewMap, << ", norm: " << p1.getNormal() << endl; } #else - real d = -((p->getVertices())[0] * p->getNormal()); + real d = -(p->getVertices()[0] * p->getNormal()); #endif if (face) { @@ -1289,7 +1289,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap) if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; } - if (!((*ve)->getNature() & Nature::SILHOUETTE) || !((*ve)->fedgeA()->isSmooth())) { + if (!((*ve)->getNature() & Nature::SILHOUETTE) || !(*ve)->fedgeA()->isSmooth()) { continue; } FEdge *fe = (*ve)->fedgeA(); @@ -1916,7 +1916,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, //------------------------------------------------------------- // first let us compute the plane equation. oface = (WFace *)(*p)->userdata; - Vec3r v1(((*p)->getVertices())[0]); + Vec3r v1((*p)->getVertices()[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); real t, t_u, t_v; @@ -2115,7 +2115,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, << "\t\t\tand ray " << vp << " * " << u << " (center " << center << ")" << endl; } #endif - Vec3r v1(((*p)->getVertices())[0]); + Vec3r v1((*p)->getVertices()[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); real t, t_u, t_v; diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 5155f06a1bb..36c06fde78e 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -80,7 +80,7 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2) /* NOTE(Ray Jones): I assume this is what they mean by using #atan2. */ /* tan = denom/udotv = y/x (see man page for atan2) */ - return (fabs(atan2(denom, udotv))); + return fabs(atan2(denom, udotv)); } bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 6f30f73d086..e8095d89ee1 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -35,7 +35,7 @@ void WingedEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) void WingedEdgeBuilder::visitNodeShape(NodeShape &ns) { // Sets the current material to iShapeode->material: - _current_frs_material = &(ns.frs_material()); + _current_frs_material = &ns.frs_material(); } void WingedEdgeBuilder::visitNodeTransform(NodeTransform &tn) diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c index c1a978162b8..b4dac1557f0 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c @@ -138,7 +138,7 @@ static void applyLength(GpencilModifierData *md, seed += BLI_hash_string(md->name); if (lmd->flag & GP_LENGTH_USE_RANDOM) { - seed += ((int)DEG_get_ctime(depsgraph)) / lmd->step; + seed += (int)DEG_get_ctime(depsgraph) / lmd->step; } float rand_offset = BLI_hash_int_01(seed); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 018a13a1c48..ec4cf71e00c 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -145,13 +145,12 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec LineartCache *local_lc = gpd->runtime.lineart_cache; if (!gpd->runtime.lineart_cache) { MOD_lineart_compute_feature_lines( - depsgraph, lmd, &gpd->runtime.lineart_cache, (!(ob->dtx & OB_DRAW_IN_FRONT))); + depsgraph, lmd, &gpd->runtime.lineart_cache, !(ob->dtx & OB_DRAW_IN_FRONT)); MOD_lineart_destroy_render_data(lmd); } else { if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) { - MOD_lineart_compute_feature_lines( - depsgraph, lmd, &local_lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); + MOD_lineart_compute_feature_lines(depsgraph, lmd, &local_lc, !(ob->dtx & OB_DRAW_IN_FRONT)); MOD_lineart_destroy_render_data(lmd); } MOD_lineart_chain_clear_picked_flag(local_lc); @@ -198,7 +197,7 @@ static void bakeModifier(Main *UNUSED(bmain), lmd->shadow_selection_override = lmd->shadow_selection; MOD_lineart_compute_feature_lines( - depsgraph, lmd, &gpd->runtime.lineart_cache, (!(ob->dtx & OB_DRAW_IN_FRONT))); + depsgraph, lmd, &gpd->runtime.lineart_cache, !(ob->dtx & OB_DRAW_IN_FRONT)); MOD_lineart_destroy_render_data(lmd); } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c index 5af8c0807b8..b04fdeb0a83 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c @@ -199,7 +199,7 @@ static int remapTime(struct GpencilModifierData *md, sequence_length += ((end - start) * mmd->segments[i].seg_repeat) * 2 + 1; } else { - sequence_length += (((end - start + 1)) * mmd->segments[i].seg_repeat); + sequence_length += ((end - start + 1) * mmd->segments[i].seg_repeat); } } segment_arr = MEM_malloc_arrayN(sequence_length, sizeof(int *), __func__); @@ -389,7 +389,7 @@ static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropSep(layout, true); uiLayoutSetActive(layout, (mode != GP_TIME_MODE_FIX && mode != GP_TIME_MODE_CHAIN) && - (RNA_boolean_get(ptr, "use_custom_frame_range"))); + RNA_boolean_get(ptr, "use_custom_frame_range")); col = uiLayoutColumn(layout, true); uiItemR(col, ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE); diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c index f32141a31eb..c46b83ea052 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -31,7 +31,7 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba, for (int i = 0; i < ba->line_count; i++) { LineartEdge *n_e = ba->linked_lines[i]; - if ((!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) { + if (!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) { continue; } @@ -186,7 +186,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld) LRT_ITER_ALL_LINES_BEGIN { - if ((!(e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) { + if (!(e->flags & LRT_EDGE_FLAG_ALL_TYPE) || (e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) { LRT_ITER_ALL_LINES_NEXT continue; } @@ -809,8 +809,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartData *ld, if (!ld->conf.fuzzy_everything) { if (ld->conf.fuzzy_intersections) { /* If none of those are intersection lines... */ - if ((!(cre->ec->type & LRT_EDGE_FLAG_INTERSECTION)) && - (!(ec->type & LRT_EDGE_FLAG_INTERSECTION))) { + if (!(cre->ec->type & LRT_EDGE_FLAG_INTERSECTION) && + !(ec->type & LRT_EDGE_FLAG_INTERSECTION)) { continue; /* We don't want to chain along different objects at the moment. */ } } @@ -1092,7 +1092,7 @@ void MOD_lineart_smooth_chains(LineartData *ld, float tolerance) eci = next_eci) { LineartEdgeChainItem *eci2, *eci3, *eci4; - if ((!(eci2 = eci->next)) || (!(eci3 = eci2->next))) { + if (!(eci2 = eci->next) || !(eci3 = eci2->next)) { /* Not enough points to simplify. */ next_eci = eci->next; continue; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index b0e00fa71fb..a8cba959689 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -2891,7 +2891,7 @@ static bool lineart_triangle_edge_image_space_occlusion(const LineartTriangle *t if ((e->flags & LRT_EDGE_FLAG_PROJECTED_SHADOW) && (e->target_reference == tri->target_reference)) { if (((dot_f > 0) && (e->flags & LRT_EDGE_FLAG_SHADOW_FACING_LIGHT)) || - ((dot_f < 0) && (!(e->flags & LRT_EDGE_FLAG_SHADOW_FACING_LIGHT)))) { + ((dot_f < 0) && !(e->flags & LRT_EDGE_FLAG_SHADOW_FACING_LIGHT))) { *from = 0.0f; *to = 1.0f; return true; @@ -3217,8 +3217,7 @@ static bool lineart_triangle_2v_intersection_math( return false; } - if (!(lineart_point_inside_triangle3d( - gloc, tri->v[0]->gloc, tri->v[1]->gloc, tri->v[2]->gloc))) { + if (!lineart_point_inside_triangle3d(gloc, tri->v[0]->gloc, tri->v[1]->gloc, tri->v[2]->gloc)) { return false; } @@ -5256,11 +5255,11 @@ static void lineart_gpencil_generate(LineartCache *cache, if (ec->shadow_mask_bits != LRT_SHADOW_MASK_UNDEFINED) { /* TODO(@Yiming): Give a behavior option for how to display undefined shadow info. */ if (shaodow_selection == LRT_SHADOW_FILTER_ILLUMINATED && - (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_ILLUMINATED))) { + !(ec->shadow_mask_bits & LRT_SHADOW_MASK_ILLUMINATED)) { continue; } if (shaodow_selection == LRT_SHADOW_FILTER_SHADED && - (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_SHADED))) { + !(ec->shadow_mask_bits & LRT_SHADOW_MASK_SHADED)) { continue; } if (shaodow_selection == LRT_SHADOW_FILTER_ILLUMINATED_ENCLOSED_SHAPES) { diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c index 138c016e2e2..80517979f30 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c @@ -102,12 +102,12 @@ static bool bake_strokes(Object *ob, } LineartCache *local_lc = *lc; if (!(*lc)) { - MOD_lineart_compute_feature_lines(dg, lmd, lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); + MOD_lineart_compute_feature_lines(dg, lmd, lc, !(ob->dtx & OB_DRAW_IN_FRONT)); MOD_lineart_destroy_render_data(lmd); } else { - if (is_first || (!(lmd->flags & LRT_GPENCIL_USE_CACHE))) { - MOD_lineart_compute_feature_lines(dg, lmd, &local_lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); + if (is_first || !(lmd->flags & LRT_GPENCIL_USE_CACHE)) { + MOD_lineart_compute_feature_lines(dg, lmd, &local_lc, !(ob->dtx & OB_DRAW_IN_FRONT)); MOD_lineart_destroy_render_data(lmd); } MOD_lineart_chain_clear_picked_flag(local_lc); diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 5fe876fc658..6528f39d4ec 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -179,7 +179,7 @@ void FrameBuffer::recursive_downsample(int max_lvl, /* Some Intel HDXXX have issue with rendering to a mipmap that is below * the texture GL_TEXTURE_MAX_LEVEL. So even if it not correct, in this case * we allow GL_TEXTURE_MAX_LEVEL to be one level lower. In practice it does work! */ - int mip_max = (GPU_mip_render_workaround()) ? mip_lvl : (mip_lvl - 1); + int mip_max = GPU_mip_render_workaround() ? mip_lvl : (mip_lvl - 1); /* Restrict fetches only to previous level. */ tex->mip_range_set(mip_lvl - 1, mip_max); /* Bind next level. */ diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index 743bc058b45..39b5a6a93c0 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -195,7 +195,7 @@ static void imm_draw_circle_partial(GPUPrimType prim_type, float sweep) { /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)M_PI_2; + const float angle_start = -DEG2RADF(start) + (float)M_PI_2; const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments); @@ -219,7 +219,7 @@ static void imm_draw_circle_partial_3d(GPUPrimType prim_type, float sweep) { /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)(M_PI / 2); + const float angle_start = -DEG2RADF(start) + (float)(M_PI / 2); const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments); @@ -259,7 +259,7 @@ static void imm_draw_disk_partial(GPUPrimType prim_type, CLAMP(sweep, -max_angle, max_angle); /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)M_PI_2; + const float angle_start = -DEG2RADF(start) + (float)M_PI_2; const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments * 2); @@ -289,7 +289,7 @@ static void imm_draw_disk_partial_3d(GPUPrimType prim_type, CLAMP(sweep, -max_angle, max_angle); /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)M_PI_2; + const float angle_start = -DEG2RADF(start) + (float)M_PI_2; const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments * 2); diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 49a2321af98..ffbba7dcd8c 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -351,7 +351,7 @@ static void detect_workarounds() } /* Somehow fixes armature display issues (see T69743). */ if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY) && - (strstr(version, "Build 20.19.15.4285"))) { + strstr(version, "Build 20.19.15.4285")) { GCaps.use_main_context_workaround = true; } /* See T70187: merging vertices fail. This has been tested from `18.2.2` till `19.3.0~dev` diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index a1570735723..dafcf4dbf33 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -568,7 +568,7 @@ std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) c std::string pre_main; ss << "\n/* Interfaces. */\n"; - const Vector<StageInterfaceInfo *> &in_interfaces = (info.geometry_source_.is_empty()) ? + const Vector<StageInterfaceInfo *> &in_interfaces = info.geometry_source_.is_empty() ? info.vertex_out_interfaces_ : info.geometry_out_interfaces_; for (const StageInterfaceInfo *iface : in_interfaces) { diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 42b587c3c81..2860944e948 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -402,7 +402,7 @@ bool imb_addrectImBuf(ImBuf *ibuf) ibuf->mall |= IB_rect; ibuf->flags |= IB_rect; if (ibuf->planes > 32) { - return (addzbufImBuf(ibuf)); + return addzbufImBuf(ibuf); } return true; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 36ebe2b7cff..4f8fe0d8cdc 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -131,7 +131,7 @@ static int an_stringdec(const char *string, char *head, char *tail, ushort *numl strcpy(head, string); head[nums] = '\0'; *numlen = nume - nums + 1; - return ((int)atoi(&(string[nums]))); + return (int)atoi(&(string[nums])); } tail[0] = '\0'; strcpy(head, string); diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index af9b62f1a74..495ec286de3 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -135,7 +135,7 @@ ImBuf *imb_bmp_decode(const uchar *mem, size_t size, int flags, char colorspace[ } /* Validate and cross-check offsets and sizes. */ - if (x < 1 || !(ELEM(depth, 1, 4, 8, 16, 24, 32))) { + if (x < 1 || !ELEM(depth, 1, 4, 8, 16, 24, 32)) { return NULL; } diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index 8188d0d04b9..9ec48447884 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -365,7 +365,7 @@ static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement, for (size_t y = 0; y < logImage->height; y++) { for (size_t x = 0; x < logImage->width * logImage->depth; x++) { row[x] = swap_ushort( - ((ushort)float_uint(data[y * logImage->width * logImage->depth + x], 4095)) << 4, + (ushort)float_uint(data[y * logImage->width * logImage->depth + x], 4095) << 4, logImage->isMSB); } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 7c2ced512f6..735472b6bdf 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1016,8 +1016,9 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, context->pts_time_base = av_q2d(context->iStream->time_base); while (av_read_frame(context->iFormatCtx, next_packet) >= 0) { - float next_progress = - (float)((int)floor(((double)next_packet->pos) * 100 / ((double)stream_size) + 0.5)) / 100; + float next_progress = (float)(int)floor( + ((double)next_packet->pos) * 100 / ((double)stream_size) + 0.5) / + 100; if (*progress != next_progress) { *progress = next_progress; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index f57d4382672..d2b94355f85 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -746,17 +746,17 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters, for (i = 0; i < parameters->tcp_numlayers; i++) { temp_rate = 0; if (img_fol->rates[i] == 0) { - parameters->tcp_rates[0] = ((float)(image->numcomps * image->comps[0].w * - image->comps[0].h * image->comps[0].prec)) / + parameters->tcp_rates[0] = (float)(image->numcomps * image->comps[0].w * + image->comps[0].h * image->comps[0].prec) / (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy); } else { - temp_rate = ((float)(image->numcomps * image->comps[0].w * image->comps[0].h * - image->comps[0].prec)) / + temp_rate = (float)(image->numcomps * image->comps[0].w * image->comps[0].h * + image->comps[0].prec) / (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy); if (temp_rate > CINEMA_24_CS) { - parameters->tcp_rates[i] = ((float)(image->numcomps * image->comps[0].w * - image->comps[0].h * image->comps[0].prec)) / + parameters->tcp_rates[i] = (float)(image->numcomps * image->comps[0].w * + image->comps[0].h * image->comps[0].prec) / (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy); } @@ -772,17 +772,17 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters, for (i = 0; i < parameters->tcp_numlayers; i++) { temp_rate = 0; if (img_fol->rates[i] == 0) { - parameters->tcp_rates[0] = ((float)(image->numcomps * image->comps[0].w * - image->comps[0].h * image->comps[0].prec)) / + parameters->tcp_rates[0] = (float)(image->numcomps * image->comps[0].w * + image->comps[0].h * image->comps[0].prec) / (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy); } else { - temp_rate = ((float)(image->numcomps * image->comps[0].w * image->comps[0].h * - image->comps[0].prec)) / + temp_rate = (float)(image->numcomps * image->comps[0].w * image->comps[0].h * + image->comps[0].prec) / (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy); if (temp_rate > CINEMA_48_CS) { - parameters->tcp_rates[0] = ((float)(image->numcomps * image->comps[0].w * - image->comps[0].h * image->comps[0].prec)) / + parameters->tcp_rates[0] = (float)(image->numcomps * image->comps[0].w * + image->comps[0].h * image->comps[0].prec) / (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy); } diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index e03765fea92..e2d49cad374 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -209,7 +209,7 @@ static void memory_source(j_decompress_ptr cinfo, const uchar *buffer, size_t si */ #define INPUT_2BYTES(cinfo, V, action) \ MAKESTMT(MAKE_BYTE_AVAIL(cinfo, action); bytes_in_buffer--; \ - V = ((uint)GETJOCTET(*next_input_byte++)) << 8; \ + V = (uint)GETJOCTET(*next_input_byte++) << 8; \ MAKE_BYTE_AVAIL(cinfo, action); \ bytes_in_buffer--; \ V += GETJOCTET(*next_input_byte++);) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index c28e8350622..d4a89c9e1c9 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1859,7 +1859,7 @@ static bool imb_exr_is_multilayer_file(MultiPartInputFile &file) * channels without a layer name will be single layer. */ channels.layers(layerNames); - return (!layerNames.empty()); + return !layerNames.empty(); } static void imb_exr_type_by_channels(ChannelList &channels, diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 4159aa851c4..81fdac40ee6 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -810,7 +810,7 @@ void IMB_rectblend(ImBuf *dbuf, else { for (x = width; x > 0; x--, dr++, or ++, sr++, cmr++) { uchar *src = (uchar *)sr; - float mask = (float)mask_max * ((float)(*cmr)); + float mask = (float)mask_max * (float)(*cmr); if (texmaskrect) { mask *= ((float)(*tmr++) / 65535.0f); @@ -908,7 +908,7 @@ void IMB_rectblend(ImBuf *dbuf, /* no destination mask buffer, do regular blend with masktexture if present */ else { for (x = width; x > 0; x--, drf += 4, orf += 4, srf += 4, cmr++) { - float mask = (float)mask_max * ((float)(*cmr)); + float mask = (float)mask_max * (float)(*cmr); if (texmaskrect) { mask *= ((float)(*tmr++) / 65535.0f); diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index acffc4e7f8f..42c19ce1a7e 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -91,7 +91,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) } if (ibuf1->x <= 1) { - return (IMB_dupImBuf(ibuf1)); + return IMB_dupImBuf(ibuf1); } ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, ibuf1->y, ibuf1->planes, ibuf1->flags); @@ -244,7 +244,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) } if (ibuf1->y <= 1) { - return (IMB_dupImBuf(ibuf1)); + return IMB_dupImBuf(ibuf1); } ibuf2 = IMB_allocImBuf(ibuf1->x, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags); @@ -441,10 +441,10 @@ ImBuf *IMB_onehalf(struct ImBuf *ibuf1) } if (ibuf1->x <= 1) { - return (IMB_half_y(ibuf1)); + return IMB_half_y(ibuf1); } if (ibuf1->y <= 1) { - return (IMB_half_x(ibuf1)); + return IMB_half_x(ibuf1); } ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags); diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index f4829386aac..0e20d0748db 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -142,7 +142,7 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) } /* all set -> do the read (copy) */ - srcAddr = (void *)(&(mfile->mem[mfile->offset])); + srcAddr = (void *)&(mfile->mem[mfile->offset]); memcpy((void *)data, srcAddr, nCopy); mfile->offset += nCopy; /* advance file ptr by copied bytes */ return nCopy; @@ -437,7 +437,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) } /* simple RGBA image */ - if (!(ELEM(bitspersample, 32, 16))) { + if (!ELEM(bitspersample, 32, 16)) { success |= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); } /* contiguous channels: RGBRGBRGB */ diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c index 298aa9c8dfa..3da93f51cfc 100644 --- a/source/blender/io/avi/intern/avi.c +++ b/source/blender/io/avi/intern/avi.c @@ -129,7 +129,7 @@ static bool fcc_is_data(int fcc) fccs[2] = fcc >> 16; fccs[3] = fcc >> 24; - if (!isdigit(fccs[0]) || !isdigit(fccs[1]) || (!ELEM(fccs[2], 'd', 'w'))) { + if (!isdigit(fccs[0]) || !isdigit(fccs[1]) || !ELEM(fccs[2], 'd', 'w')) { return 0; } if (!ELEM(fccs[3], 'b', 'c')) { diff --git a/source/blender/io/gpencil/intern/gpencil_io_capi.cc b/source/blender/io/gpencil/intern/gpencil_io_capi.cc index ac5f8cf7c8d..96a6cc66b25 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_capi.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_capi.cc @@ -108,7 +108,7 @@ static bool gpencil_io_export_pdf(Depsgraph *depsgraph, case GP_EXPORT_FRAME_SCENE: { for (int32_t i = iparams->frame_start; i < iparams->frame_end + 1; i++) { if ((iparams->frame_mode == GP_EXPORT_FRAME_SELECTED) && - (!is_keyframe_included(gpd_eval, i, true))) { + !is_keyframe_included(gpd_eval, i, true)) { continue; } diff --git a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc index cd97d5fb485..8d1171097b8 100644 --- a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc @@ -100,7 +100,7 @@ class obj_importer_test : public BlendfileLoadingBaseTest { const Span<MVert> verts = mesh->verts(); EXPECT_V3_NEAR(verts.first().co, exp.vert_first, 0.0001f); EXPECT_V3_NEAR(verts.last().co, exp.vert_last, 0.0001f); - const float3 *lnors = (const float3 *)(CustomData_get_layer(&mesh->ldata, CD_NORMAL)); + const float3 *lnors = (const float3 *)CustomData_get_layer(&mesh->ldata, CD_NORMAL); float3 normal_first = lnors != nullptr ? lnors[0] : float3(0, 0, 0); EXPECT_V3_NEAR(normal_first, exp.normal_first, 0.0001f); const MLoopUV *mloopuv = static_cast<const MLoopUV *>( @@ -108,8 +108,7 @@ class obj_importer_test : public BlendfileLoadingBaseTest { float2 uv_first = mloopuv ? float2(mloopuv->uv) : float2(0, 0); EXPECT_V2_NEAR(uv_first, exp.uv_first, 0.0001f); if (exp.color_first.x >= 0) { - const float4 *colors = (const float4 *)(CustomData_get_layer(&mesh->vdata, - CD_PROP_COLOR)); + const float4 *colors = (const float4 *)CustomData_get_layer(&mesh->vdata, CD_PROP_COLOR); EXPECT_TRUE(colors != nullptr); EXPECT_V4_NEAR(colors[0], exp.color_first, 0.0001f); } diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index d4a20a29bf7..b75bf5383de 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -497,7 +497,7 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error sdna->pointer_size = sdna->types_size[struct_info->type] / 2; - if (struct_info->members_len != 2 || (!ELEM(sdna->pointer_size, 4, 8))) { + if (struct_info->members_len != 2 || !ELEM(sdna->pointer_size, 4, 8)) { *r_error_message = "ListBase struct error! Needs it to calculate pointer-size."; /* Well, at least `sizeof(ListBase)` is error proof! (ton). */ return false; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 7b893078b22..0728f69b449 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -431,7 +431,7 @@ static int add_name(const char *str) */ buf[i] = 0; DEBUG_PRINTF(3, "Name before chomping: %s\n", buf); - if ((strncmp(buf, "(*headdraw", 10) == 0) || (strncmp(buf, "(*windraw", 9) == 0)) { + if ((strncmp(buf, "(*headdraw", 10) == 0) || strncmp(buf, "(*windraw", 9) == 0) { buf[i] = ')'; buf[i + 1] = '('; buf[i + 2] = 'v'; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 9cb501a6403..3592ecd84c8 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -564,7 +564,7 @@ static int rna_enum_bitmask(PropertyRNA *prop) static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp) { - return ((prop->type == PROP_FLOAT) && (ELEM(prop->subtype, PROP_COLOR, PROP_COLOR_GAMMA)) && + return ((prop->type == PROP_FLOAT) && ELEM(prop->subtype, PROP_COLOR, PROP_COLOR_GAMMA) && (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0)); } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 370ccaf9f64..b7856794da2 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -147,7 +147,7 @@ PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier) for (link = listbase->first; link; link = link->next) { PropertyRNA *prop = ((PropertyDefRNA *)link)->prop; - if (prop && (STREQ(prop->identifier, identifier))) { + if (prop && STREQ(prop->identifier, identifier)) { return (PropertyDefRNA *)link; } } diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index b01bcec0bc1..897a25711cd 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1464,7 +1464,7 @@ static void quad_from_tris(BMEdge *e, BMFace *adj[2], BMVert *ndx[4]) ndx[j] = tri[0][i]; /* When the triangle edge cuts across our quad-to-be, * throw in the second triangle's vertex */ - if ((ELEM(tri[0][i], e->v1, e->v2)) && + if (ELEM(tri[0][i], e->v1, e->v2) && (tri[0][(i + 1) % 3] == e->v1 || tri[0][(i + 1) % 3] == e->v2)) { j++; ndx[j] = opp; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 1e9fde2899a..9efedf744ec 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -797,8 +797,7 @@ static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, Pointer PropertyRNA *prop = RNA_struct_find_property(ptr, "layer"); const char *layer_name; - if (!(RNA_property_enum_identifier( - C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name))) { + if (!RNA_property_enum_identifier(C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name)) { return; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc index 7b2a85de3cb..f39337d3fc3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc @@ -189,22 +189,22 @@ class ImageFieldsFunction : public fn::MultiFunction { v[2] = ((-0.5f * ty + 0.5f) * ty + 0.5f) * ty + (1.0f / 6.0f); v[3] = (1.0f / 6.0f) * ty * ty * ty; - return (v[0] * (u[0] * (image_pixel_lookup(ibuf, xc[0], yc[0])) + - u[1] * (image_pixel_lookup(ibuf, xc[1], yc[0])) + - u[2] * (image_pixel_lookup(ibuf, xc[2], yc[0])) + - u[3] * (image_pixel_lookup(ibuf, xc[3], yc[0])))) + - (v[1] * (u[0] * (image_pixel_lookup(ibuf, xc[0], yc[1])) + - u[1] * (image_pixel_lookup(ibuf, xc[1], yc[1])) + - u[2] * (image_pixel_lookup(ibuf, xc[2], yc[1])) + - u[3] * (image_pixel_lookup(ibuf, xc[3], yc[1])))) + - (v[2] * (u[0] * (image_pixel_lookup(ibuf, xc[0], yc[2])) + - u[1] * (image_pixel_lookup(ibuf, xc[1], yc[2])) + - u[2] * (image_pixel_lookup(ibuf, xc[2], yc[2])) + - u[3] * (image_pixel_lookup(ibuf, xc[3], yc[2])))) + - (v[3] * (u[0] * (image_pixel_lookup(ibuf, xc[0], yc[3])) + - u[1] * (image_pixel_lookup(ibuf, xc[1], yc[3])) + - u[2] * (image_pixel_lookup(ibuf, xc[2], yc[3])) + - u[3] * (image_pixel_lookup(ibuf, xc[3], yc[3])))); + return (v[0] * (u[0] * image_pixel_lookup(ibuf, xc[0], yc[0]) + + u[1] * image_pixel_lookup(ibuf, xc[1], yc[0]) + + u[2] * image_pixel_lookup(ibuf, xc[2], yc[0]) + + u[3] * image_pixel_lookup(ibuf, xc[3], yc[0]))) + + (v[1] * (u[0] * image_pixel_lookup(ibuf, xc[0], yc[1]) + + u[1] * image_pixel_lookup(ibuf, xc[1], yc[1]) + + u[2] * image_pixel_lookup(ibuf, xc[2], yc[1]) + + u[3] * image_pixel_lookup(ibuf, xc[3], yc[1]))) + + (v[2] * (u[0] * image_pixel_lookup(ibuf, xc[0], yc[2]) + + u[1] * image_pixel_lookup(ibuf, xc[1], yc[2]) + + u[2] * image_pixel_lookup(ibuf, xc[2], yc[2]) + + u[3] * image_pixel_lookup(ibuf, xc[3], yc[2]))) + + (v[3] * (u[0] * image_pixel_lookup(ibuf, xc[0], yc[3]) + + u[1] * image_pixel_lookup(ibuf, xc[1], yc[3]) + + u[2] * image_pixel_lookup(ibuf, xc[2], yc[3]) + + u[3] * image_pixel_lookup(ibuf, xc[3], yc[3]))); } static float4 image_linear_texture_lookup(const ImBuf *ibuf, diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc index e3b06aaae90..5a058eec690 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc @@ -64,7 +64,7 @@ static int node_shader_gpu_eevee_specular(GPUMaterial *mat, GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY); - float use_clear = (socket_not_zero(6)) ? 1.0f : 0.0f; + float use_clear = socket_not_zero(6) ? 1.0f : 0.0f; return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_constant(&use_clear)); } diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 35d5cb6a994..72473fce64d 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -234,7 +234,7 @@ static int bpy_slot_from_py(BMesh *bm, return -1; } const ushort size = pymat->col_num; - if ((size != pymat->row_num) || (!ELEM(size, 3, 4))) { + if ((size != pymat->row_num) || !ELEM(size, 3, 4)) { PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" expected a 3x3 or 4x4 matrix", opname, @@ -738,7 +738,7 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw) BMOperator bmop; if ((PyTuple_GET_SIZE(args) == 1) && (py_bm = (BPy_BMesh *)PyTuple_GET_ITEM(args, 0)) && - (BPy_BMesh_Check(py_bm))) { + BPy_BMesh_Check(py_bm)) { BPY_BM_CHECK_OBJ(py_bm); bm = py_bm->bm; diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index 056af83cc49..14f1958b71d 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -150,13 +150,13 @@ static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw) } if (/* X range. */ - (!(crop.xmin >= 0 && crop.xmax < self->ibuf->x)) || + !(crop.xmin >= 0 && crop.xmax < self->ibuf->x) || /* Y range. */ - (!(crop.ymin >= 0 && crop.ymax < self->ibuf->y)) || + !(crop.ymin >= 0 && crop.ymax < self->ibuf->y) || /* X order. */ - (!(crop.xmin <= crop.xmax)) || + !(crop.xmin <= crop.xmax) || /* Y order. */ - (!(crop.ymin <= crop.ymax))) { + !(crop.ymin <= crop.ymax)) { PyErr_SetString(PyExc_ValueError, "ImBuf crop min/max not in range"); return NULL; } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 681c5404ed9..9e140bbe7bd 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -1475,7 +1475,7 @@ bool PyC_RunString_AsNumber(const char *imports[], PyErr_Clear(); } - if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) { + if (imports && !PyC_NameSpace_ImportArray(py_dict, imports)) { ok = false; } else if ((retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict)) == NULL) { @@ -1533,7 +1533,7 @@ bool PyC_RunString_AsIntPtr(const char *imports[], py_dict = PyC_DefaultNameSpace(filename); - if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) { + if (imports && !PyC_NameSpace_ImportArray(py_dict, imports)) { ok = false; } else if ((retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict)) == NULL) { @@ -1572,7 +1572,7 @@ bool PyC_RunString_AsStringAndSize(const char *imports[], py_dict = PyC_DefaultNameSpace(filename); - if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) { + if (imports && !PyC_NameSpace_ImportArray(py_dict, imports)) { ok = false; } else if ((retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict)) == NULL) { diff --git a/source/blender/python/intern/bpy_interface_run.c b/source/blender/python/intern/bpy_interface_run.c index 886f5ee278d..49f5261ba19 100644 --- a/source/blender/python/intern/bpy_interface_run.c +++ b/source/blender/python/intern/bpy_interface_run.c @@ -259,7 +259,7 @@ static bool bpy_run_string_impl(bContext *C, py_dict = PyC_DefaultNameSpace("<blender string>"); - if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) { + if (imports && !PyC_NameSpace_ImportArray(py_dict, imports)) { Py_DECREF(py_dict); retval = NULL; } diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c index 32519e5e373..4e41c44cab4 100644 --- a/source/blender/python/intern/bpy_msgbus.c +++ b/source/blender/python/intern/bpy_msgbus.c @@ -265,7 +265,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args } if (py_options && - (pyrna_enum_bitfield_from_set(py_options_enum, py_options, &options, error_prefix)) == -1) { + (pyrna_enum_bitfield_from_set(py_options_enum, py_options, &options, error_prefix) == -1)) { return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 56ad05d5501..0eaa5d6b6c7 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1811,7 +1811,7 @@ static int pyrna_py_to_prop( * 'self.properties -> self' * class mixing. If this causes problems in the future it should be removed. */ - if ((ptr_type == &RNA_AnyType) && (BPy_StructRNA_Check(value))) { + if ((ptr_type == &RNA_AnyType) && BPy_StructRNA_Check(value)) { const StructRNA *base_type = RNA_struct_base_child_of( ((const BPy_StructRNA *)value)->ptr.type, NULL); if (ELEM(base_type, &RNA_Operator, &RNA_Gizmo)) { @@ -1957,7 +1957,7 @@ static int pyrna_py_to_prop( BKE_reports_init(&reports, RPT_STORE); RNA_property_pointer_set( ptr, prop, (param == NULL) ? PointerRNA_NULL : param->ptr, &reports); - const int err = (BPy_reports_to_error(&reports, PyExc_RuntimeError, true)); + const int err = BPy_reports_to_error(&reports, PyExc_RuntimeError, true); if (err == -1) { Py_XDECREF(value_new); return -1; @@ -2479,7 +2479,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) { ID *id = itemptr.data; /* Always an ID. */ - if (id->lib == lib && (STREQLEN(keyname, id->name + 2, sizeof(id->name) - 2))) { + if (id->lib == lib && STREQLEN(keyname, id->name + 2, sizeof(id->name) - 2)) { found = true; if (r_ptr) { *r_ptr = itemptr; @@ -5574,7 +5574,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self, } else { const char f = buf.format ? buf.format[0] : 0; - if ((prop_type == PROP_INT && (buf.itemsize != sizeof(int) || (!ELEM(f, 'l', 'i')))) || + if ((prop_type == PROP_INT && (buf.itemsize != sizeof(int) || !ELEM(f, 'l', 'i'))) || (prop_type == PROP_FLOAT && (buf.itemsize != sizeof(float) || f != 'f'))) { PyBuffer_Release(&buf); PyErr_Format(PyExc_TypeError, "incorrect sequence item type: %s", buf.format); @@ -6404,7 +6404,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject BKE_reports_init(&reports, RPT_STORE); RNA_function_call(C, &reports, self_ptr, self_func, &parms); - err = (BPy_reports_to_error(&reports, PyExc_RuntimeError, true)); + err = BPy_reports_to_error(&reports, PyExc_RuntimeError, true); /* Return value. */ if (err != -1) { @@ -7668,7 +7668,7 @@ bool pyrna_id_FromPyObject(PyObject *obj, ID **id) bool pyrna_id_CheckPyObject(PyObject *obj) { - return BPy_StructRNA_Check(obj) && (RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type)); + return BPy_StructRNA_Check(obj) && RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type); } void BPY_rna_init(void) @@ -8796,7 +8796,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param ReportList *reports; /* Alert the user, else they won't know unless they see the console. */ if ((!is_staticmethod) && (!is_classmethod) && (ptr->data) && - (RNA_struct_is_a(ptr->type, &RNA_Operator)) && + RNA_struct_is_a(ptr->type, &RNA_Operator) && (is_valid_wm == (CTX_wm_manager(C) != NULL))) { wmOperator *op = ptr->data; reports = op->reports; diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 432b1709d82..5218ea68f7b 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -73,9 +73,8 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) case 0: break; case 1: - if ((mathutils_array_parse( - col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == - -1) { + if (mathutils_array_parse( + col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()") == -1) { return NULL; } break; diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 8da2b20d9a5..ddc0f115742 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -215,7 +215,7 @@ static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args) return NULL; } - if (!(ELEM(axis, 'X', 'Y', 'Z'))) { + if (!ELEM(axis, 'X', 'Y', 'Z')) { PyErr_SetString(PyExc_ValueError, "Euler.rotate_axis(): " "expected axis to be 'X', 'Y' or 'Z'"); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 51362ec595f..a44f42bc337 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -725,7 +725,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) "cannot create a 2x2 rotation matrix around arbitrary axis"); return NULL; } - if ((ELEM(matSize, 3, 4)) && (axis == NULL) && (vec == NULL)) { + if (ELEM(matSize, 3, 4) && (axis == NULL) && (vec == NULL)) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "axis of rotation for 3d and 4d matrices is required"); diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index d5519676081..976c1da1916 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -830,7 +830,7 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op) return NULL; } - ok = (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1; + ok = EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1) ? 0 : -1; } switch (op) { diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 654ddcb1237..290be771c90 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -2680,7 +2680,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure size_from = axis_from; } - else if (((void)PyErr_Clear()), /* run but ignore the result */ + else if ((void)PyErr_Clear(), /* run but ignore the result */ (size_from = mathutils_array_parse( vec_assign, 2, 4, value, "mathutils.Vector.**** = swizzle assignment")) == -1) { return -1; diff --git a/source/blender/render/intern/texture_image.c b/source/blender/render/intern/texture_image.c index 38a569877c0..60a769348e8 100644 --- a/source/blender/render/intern/texture_image.c +++ b/source/blender/render/intern/texture_image.c @@ -889,7 +889,7 @@ static void alpha_clip_aniso( /* TXF alpha: we're doing the same alpha-clip here as box-sample, but I'm doubting * if this is actually correct for the all the filtering algorithms. */ - if (!(ELEM(extflag, TXC_REPT, TXC_EXTD))) { + if (!ELEM(extflag, TXC_REPT, TXC_EXTD)) { rf.xmin = minx * (ibuf->x); rf.xmax = maxx * (ibuf->x); rf.ymin = miny * (ibuf->y); diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index e6c641a5532..6d182b6bcca 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -407,7 +407,7 @@ Sequence *SEQ_sequence_from_strip_elem(ListBase *seqbase, StripElem *se) for (iseq = seqbase->first; iseq; iseq = iseq->next) { Sequence *seq_found; if ((iseq->strip && iseq->strip->stripdata) && - (ARRAY_HAS_ITEM(se, iseq->strip->stripdata, iseq->len))) { + ARRAY_HAS_ITEM(se, iseq->strip->stripdata, iseq->len)) { break; } if ((seq_found = SEQ_sequence_from_strip_elem(&iseq->seqbase, se))) { diff --git a/source/blender/simulation/intern/SIM_mass_spring.cpp b/source/blender/simulation/intern/SIM_mass_spring.cpp index 8e2c7d641ab..5858e16da6e 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cpp +++ b/source/blender/simulation/intern/SIM_mass_spring.cpp @@ -588,7 +588,7 @@ static void cloth_calc_force( SIM_mass_spring_force_gravity(data, i, vert->mass, gravity); /* Vertex goal springs */ - if ((!(vert->flags & CLOTH_VERT_FLAG_PINNED)) && (vert->goal > FLT_EPSILON)) { + if (!(vert->flags & CLOTH_VERT_FLAG_PINNED) && (vert->goal > FLT_EPSILON)) { float goal_x[3], goal_v[3]; float k; diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 054426b8874..cb6c963b7d2 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -68,7 +68,7 @@ struct HairGrid { }; #define HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, axis) \ - (min_ii(max_ii(int((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2)) + min_ii(max_ii(int((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2) BLI_INLINE int hair_grid_offset(const float vec[3], const int res[3], diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c index 80876dfd798..9f0506f209b 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c @@ -33,7 +33,7 @@ BLI_INLINE wmGizmoProperty *wm_gizmo_target_property_array(wmGizmo *gz) { - return (wmGizmoProperty *)(POINTER_OFFSET(gz, gz->type->struct_size)); + return (wmGizmoProperty *)POINTER_OFFSET(gz, gz->type->struct_size); } wmGizmoProperty *WM_gizmo_target_property_array(wmGizmo *gz) diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 6a10680fc8b..affe0bcf45a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -2230,7 +2230,7 @@ static wmKeyMapItem *wm_eventmatch_modal_keymap_items(const wmKeyMap *keymap, /* Should already be handled by #wm_user_modal_keymap_set_items. */ BLI_assert(kmi->propvalue_str[0] == '\0'); if (wm_eventmatch(event, kmi)) { - if ((keymap->poll_modal_item == nullptr) || (keymap->poll_modal_item(op, kmi->propvalue))) { + if ((keymap->poll_modal_item == nullptr) || keymap->poll_modal_item(op, kmi->propvalue)) { return kmi; } } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index e5ab876e75f..32890b4014f 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -454,7 +454,7 @@ void WM_exit_ex(bContext *C, const bool do_python) if ((has_edited && BLO_write_file( bmain, filepath, fileflags, &(const struct BlendFileWriteParams){0}, NULL)) || - (BLO_memfile_write_file(undo_memfile, filepath))) { + BLO_memfile_write_file(undo_memfile, filepath)) { printf("Saved session recovery to '%s'\n", filepath); } } diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index d1c27504628..1da8159df13 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -235,8 +235,8 @@ void WM_operatortype_last_properties_clear_all(void) { GHashIterator iter; - for (WM_operatortype_iter(&iter); (!BLI_ghashIterator_done(&iter)); - (BLI_ghashIterator_step(&iter))) { + for (WM_operatortype_iter(&iter); !BLI_ghashIterator_done(&iter); + BLI_ghashIterator_step(&iter)) { wmOperatorType *ot = BLI_ghashIterator_getValue(&iter); if (ot->last_properties) { diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c index 7953efb49fe..e903ac11fba 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c @@ -28,7 +28,7 @@ BLI_INLINE uint void_hash_uint(const void *key) { - size_t y = (size_t)key >> (sizeof(void *)); + size_t y = (size_t)key >> sizeof(void *); return (uint)y; } diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c index 3f0c72a4a05..543e5782a5a 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c @@ -943,7 +943,7 @@ static int wm_xr_navigation_fly_modal(bContext *C, wmOperator *op, const wmEvent const double time_now = PIL_check_seconds_timer(); mode = (eXrFlyMode)RNA_enum_get(op->ptr, "mode"); - turn = (ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT)); + turn = ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT); locz_lock = RNA_boolean_get(op->ptr, "lock_location_z"); dir_lock = RNA_boolean_get(op->ptr, "lock_direction"); |