From f68cfd6bb078482c4a779a6e26a56e2734edb5b8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2022 18:33:28 +1000 Subject: Cleanup: replace C-style casts with functional casts for numeric types --- source/blender/editors/object/object_add.cc | 2 +- source/blender/editors/object/object_modifier.cc | 2 +- source/blender/editors/object/object_remesh.cc | 10 +++++----- source/blender/editors/object/object_transform.cc | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/object') diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 9d06a6d5f40..a24b6ed4830 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -287,7 +287,7 @@ void ED_object_rotation_from_quat(float rot[3], const float viewquat[4], const c } case 'Y': { quat_to_eul(rot, viewquat); - rot[0] -= (float)M_PI_2; + rot[0] -= float(M_PI_2); break; } case 'Z': { diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index 3d995c84639..424bf3c73e2 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -2814,7 +2814,7 @@ static int correctivesmooth_bind_exec(bContext *C, wmOperator *op) /* Signal to modifier to recalculate. */ CorrectiveSmoothModifierData *csmd_eval = (CorrectiveSmoothModifierData *) BKE_modifier_get_evaluated(depsgraph, ob, &csmd->modifier); - csmd_eval->bind_coords_num = (uint)-1; + csmd_eval->bind_coords_num = uint(-1); /* Force modifier to run, it will call binding routine * (this has to happen outside of depsgraph evaluation). */ diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index 4fe4b087042..9f59549d3db 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -246,7 +246,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d, const float spacing) { const float total_len = len_v3v3(initial_co, end_co); - const int tot_lines = (int)(total_len / spacing); + const int tot_lines = int(total_len / spacing); const int tot_lines_half = (tot_lines / 2) + 1; float spacing_dir[3], lines_start[3]; float line_dir[3]; @@ -261,7 +261,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d, mid_v3_v3v3(lines_start, initial_co, end_co); - immBegin(GPU_PRIM_LINES, (uint)tot_lines_half * 2); + immBegin(GPU_PRIM_LINES, uint(tot_lines_half) * 2); for (int i = 0; i < tot_lines_half; i++) { float line_start[3]; float line_end[3]; @@ -274,7 +274,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d, mul_v3_fl(spacing_dir, -1.0f); - immBegin(GPU_PRIM_LINES, (uint)(tot_lines_half - 1) * 2); + immBegin(GPU_PRIM_LINES, uint(tot_lines_half - 1) * 2); for (int i = 1; i < tot_lines_half; i++) { float line_start[3]; float line_end[3]; @@ -320,7 +320,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion *UNUSED(ar), void *a GPU_line_width(1.0f); const float total_len = len_v3v3(cd->preview_plane[0], cd->preview_plane[1]); - const int tot_lines = (int)(total_len / cd->voxel_size); + const int tot_lines = int(total_len / cd->voxel_size); /* Smooth-step to reduce the alpha of the grid as the line number increases. */ const float a = VOXEL_SIZE_EDIT_MAX_GRIDS_LINES * 0.1f; @@ -346,7 +346,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion *UNUSED(ar), void *a UnitSettings *unit = &scene->unit; BKE_unit_value_as_string(str, VOXEL_SIZE_EDIT_MAX_STR_LEN, - (double)(cd->voxel_size * unit->scale_length), + double(cd->voxel_size * unit->scale_length), -3, B_UNIT_LENGTH, unit, diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc index 0a86ae28b3e..0735e93437d 100644 --- a/source/blender/editors/object/object_transform.cc +++ b/source/blender/editors/object/object_transform.cc @@ -1288,7 +1288,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } else { /* #V3D_AROUND_CENTER_MEDIAN. */ if (em->bm->totvert) { - const float total_div = 1.0f / (float)em->bm->totvert; + const float total_div = 1.0f / float(em->bm->totvert); BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { madd_v3_v3fl(cent, eve->co, total_div); } @@ -2079,7 +2079,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const if (event->type == MOUSEMOVE || is_translate_init) { const ViewDepths *depths = xfd->depths; - if (depths && ((uint)event->mval[0] < depths->w) && ((uint)event->mval[1] < depths->h)) { + if (depths && (uint(event->mval[0]) < depths->w) && (uint(event->mval[1]) < depths->h)) { float depth_fl = 1.0f; ED_view3d_depth_read_cached(depths, event->mval, 0, &depth_fl); float location_world[3]; -- cgit v1.2.3