From 331f8500569df9b3b2aa776c5bcaad7b99c57295 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Oct 2022 22:52:53 +1100 Subject: Cleanup: redundant parenthesis --- source/blender/blenkernel/intern/anim_sys.c | 2 +- .../blender/blenkernel/intern/blender_user_menu.c | 2 +- source/blender/blenkernel/intern/camera.c | 6 ++-- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenkernel/intern/collection.c | 6 ++-- source/blender/blenkernel/intern/colortools.c | 2 +- source/blender/blenkernel/intern/context.c | 2 +- source/blender/blenkernel/intern/cryptomatte.cc | 2 +- source/blender/blenkernel/intern/curve.cc | 8 ++--- source/blender/blenkernel/intern/curve_deform.c | 2 +- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/editmesh.cc | 2 +- source/blender/blenkernel/intern/effect.c | 2 +- source/blender/blenkernel/intern/fcurve_driver.c | 2 +- source/blender/blenkernel/intern/fluid.c | 6 ++-- source/blender/blenkernel/intern/gpencil.c | 40 +++++++++++----------- .../blender/blenkernel/intern/gpencil_modifier.c | 8 ++--- source/blender/blenkernel/intern/image_format.cc | 2 +- source/blender/blenkernel/intern/image_save.cc | 2 +- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/mask_rasterize.c | 4 +-- source/blender/blenkernel/intern/mball.cc | 2 +- source/blender/blenkernel/intern/nla.c | 3 +- source/blender/blenkernel/intern/object.cc | 2 +- source/blender/blenkernel/intern/ocean.c | 27 +++++++-------- source/blender/blenkernel/intern/particle.c | 7 ++-- .../blenkernel/intern/particle_distribute.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 8 ++--- source/blender/blenkernel/intern/studiolight.c | 6 ++-- source/blender/blenkernel/intern/subdiv_ccg.cc | 4 +-- source/blender/blenkernel/intern/tracking.c | 4 +-- source/blender/blenkernel/intern/vfont.c | 4 +-- 32 files changed, 84 insertions(+), 91 deletions(-) (limited to 'source/blender/blenkernel') 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(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( MEM_calloc_arrayN(num_grids, sizeof(CCGElem *), "subdiv ccg grids")); - subdiv_ccg->grids_storage = static_cast(MEM_calloc_arrayN( - num_grids, (size_t(grid_area)) * element_size, "subdiv ccg grids storage")); + subdiv_ccg->grids_storage = static_cast( + 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 */ } -- cgit v1.2.3