diff options
Diffstat (limited to 'source/blender/editors')
102 files changed, 265 insertions, 271 deletions
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)) { |