Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-26 10:38:25 +0300
committerCampbell Barton <campbell@blender.org>2022-09-26 10:58:36 +0300
commit333e41eac6daf60c6aa9df0496a39c57d74b9c87 (patch)
tree5986e980fd64bc4ef1c3dda125a0f9dca4bab2c8 /source/blender/io
parent0210c4df1793799a09a35e44be286dfca88769dc (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Use function style casts in C++ headers & source.
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/alembic/exporter/abc_archive.cc2
-rw-r--r--source/blender/io/alembic/exporter/abc_export_capi.cc4
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_curves.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_reader_camera.cc18
-rw-r--r--source/blender/io/alembic/intern/abc_reader_curves.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_reader_mesh.cc4
-rw-r--r--source/blender/io/alembic/intern/abc_reader_object.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_util.cc4
-rw-r--r--source/blender/io/alembic/intern/alembic_capi.cc6
-rw-r--r--source/blender/io/usd/intern/usd_reader_curve.h2
-rw-r--r--source/blender/io/usd/intern/usd_reader_nurbs.h2
-rw-r--r--source/blender/io/usd/intern/usd_reader_volume.h2
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh6
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_objects.hh2
14 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/io/alembic/exporter/abc_archive.cc b/source/blender/io/alembic/exporter/abc_archive.cc
index c4a4f129ecf..55e172db241 100644
--- a/source/blender/io/alembic/exporter/abc_archive.cc
+++ b/source/blender/io/alembic/exporter/abc_archive.cc
@@ -130,7 +130,7 @@ static TimeSamplingPtr create_time_sampling(double scene_fps,
get_shutter_samples(scene_fps, params, nr_of_samples, true, samples);
- TimeSamplingType ts(static_cast<uint32_t>(samples.size()), 1.0 / scene_fps);
+ TimeSamplingType ts(uint32_t(samples.size()), 1.0 / scene_fps);
return TimeSamplingPtr(new TimeSampling(ts, samples)); // NOLINT: modernize-make-shared
}
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc
index dfca89e2c6d..546bc9d49cc 100644
--- a/source/blender/io/alembic/exporter/abc_export_capi.cc
+++ b/source/blender/io/alembic/exporter/abc_export_capi.cc
@@ -144,8 +144,8 @@ static void export_startjob(void *customdata,
}
/* Update the scene for the next frame to render. */
- scene->r.cfra = static_cast<int>(frame);
- scene->r.subframe = static_cast<float>(frame - scene->r.cfra);
+ scene->r.cfra = int(frame);
+ scene->r.subframe = float(frame - scene->r.cfra);
BKE_scene_graph_update_for_newframe(data->depsgraph);
CLOG_INFO(&LOG, 2, "Exporting frame %.2f", frame);
diff --git a/source/blender/io/alembic/exporter/abc_writer_curves.cc b/source/blender/io/alembic/exporter/abc_writer_curves.cc
index 4717d3ec26e..e5e8053d7d3 100644
--- a/source/blender/io/alembic/exporter/abc_writer_curves.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_curves.cc
@@ -142,7 +142,7 @@ void ABCCurveWriter::do_write(HierarchyContext &context)
}
}
- orders.push_back(static_cast<uint8_t>(nurbs->orderu));
+ orders.push_back(uint8_t(nurbs->orderu));
vert_counts.push_back(verts.size() - current_point_count);
}
diff --git a/source/blender/io/alembic/intern/abc_reader_camera.cc b/source/blender/io/alembic/intern/abc_reader_camera.cc
index 830526a11ac..e7a319730b6 100644
--- a/source/blender/io/alembic/intern/abc_reader_camera.cc
+++ b/source/blender/io/alembic/intern/abc_reader_camera.cc
@@ -77,11 +77,11 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
bcam->stereo.convergence_distance = convergence_plane.getValue(sample_sel);
}
- const float lens = static_cast<float>(cam_sample.getFocalLength());
- const float apperture_x = static_cast<float>(cam_sample.getHorizontalAperture());
- const float apperture_y = static_cast<float>(cam_sample.getVerticalAperture());
- const float h_film_offset = static_cast<float>(cam_sample.getHorizontalFilmOffset());
- const float v_film_offset = static_cast<float>(cam_sample.getVerticalFilmOffset());
+ const float lens = float(cam_sample.getFocalLength());
+ const float apperture_x = float(cam_sample.getHorizontalAperture());
+ const float apperture_y = float(cam_sample.getVerticalAperture());
+ const float h_film_offset = float(cam_sample.getHorizontalFilmOffset());
+ const float v_film_offset = float(cam_sample.getVerticalFilmOffset());
const float film_aspect = apperture_x / apperture_y;
bcam->lens = lens;
@@ -89,10 +89,10 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
bcam->sensor_y = apperture_y * 10;
bcam->shiftx = h_film_offset / apperture_x;
bcam->shifty = v_film_offset / apperture_y / film_aspect;
- bcam->clip_start = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
- bcam->clip_end = static_cast<float>(cam_sample.getFarClippingPlane());
- bcam->dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance());
- bcam->dof.aperture_fstop = static_cast<float>(cam_sample.getFStop());
+ bcam->clip_start = max_ff(0.1f, float(cam_sample.getNearClippingPlane()));
+ bcam->clip_end = float(cam_sample.getFarClippingPlane());
+ bcam->dof.focus_distance = float(cam_sample.getFocusDistance());
+ bcam->dof.aperture_fstop = float(cam_sample.getFStop());
m_object = BKE_object_add_only_object(bmain, OB_CAMERA, m_object_name.c_str());
m_object->data = bcam;
diff --git a/source/blender/io/alembic/intern/abc_reader_curves.cc b/source/blender/io/alembic/intern/abc_reader_curves.cc
index d8859acdf5f..24bdae3ac50 100644
--- a/source/blender/io/alembic/intern/abc_reader_curves.cc
+++ b/source/blender/io/alembic/intern/abc_reader_curves.cc
@@ -152,7 +152,7 @@ void AbcCurveReader::read_curve_sample(Curve *cu,
break;
case Alembic::AbcGeom::kVariableOrder:
if (orders && orders->size() > i) {
- nu->orderu = static_cast<short>((*orders)[i]);
+ nu->orderu = short((*orders)[i]);
break;
}
ATTR_FALLTHROUGH;
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index 6ddf55109ab..f08514dc45c 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -133,7 +133,7 @@ static void read_mverts_interp(MVert *mverts,
const Imath::V3f &floor_pos = (*positions)[i];
const Imath::V3f &ceil_pos = (*ceil_positions)[i];
- interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), static_cast<float>(weight));
+ interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), float(weight));
copy_zup_from_yup(mvert.co, tmp);
}
}
@@ -448,7 +448,7 @@ static void read_velocity(const V3fArraySamplePtr &velocities,
const CDStreamConfig &config,
const float velocity_scale)
{
- const int num_velocity_vectors = static_cast<int>(velocities->size());
+ const int num_velocity_vectors = int(velocities->size());
if (num_velocity_vectors != config.mesh->totvert) {
/* Files containing videogrammetry data may be malformed and export velocity data on missing
* frames (most likely by copying the last valid data). */
diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc
index db056c0eef6..5cf1fda0db2 100644
--- a/source/blender/io/alembic/intern/abc_reader_object.cc
+++ b/source/blender/io/alembic/intern/abc_reader_object.cc
@@ -110,7 +110,7 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0,
convert_matrix_datatype(m0, mat0);
convert_matrix_datatype(m1, mat1);
- interp_m4_m4m4(ret, mat0, mat1, static_cast<float>(weight));
+ interp_m4_m4m4(ret, mat0, mat1, float(weight));
return convert_matrix_datatype(ret);
}
diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc
index 90f73d25c22..846a3622d62 100644
--- a/source/blender/io/alembic/intern/abc_util.cc
+++ b/source/blender/io/alembic/intern/abc_util.cc
@@ -73,7 +73,7 @@ Imath::M44d convert_matrix_datatype(float mat[4][4])
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- m[i][j] = static_cast<double>(mat[i][j]);
+ m[i][j] = double(mat[i][j]);
}
}
@@ -84,7 +84,7 @@ void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4])
{
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- r_mat[i][j] = static_cast<float>(xform[i][j]);
+ r_mat[i][j] = float(xform[i][j]);
}
}
}
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index 11c26fd2f72..39595089109 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -502,7 +502,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
/* Create objects and set scene frame range. */
- const float size = static_cast<float>(data->readers.size());
+ const float size = float(data->readers.size());
size_t i = 0;
chrono_t min_time = std::numeric_limits<chrono_t>::max();
@@ -542,8 +542,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
scene->r.cfra = scene->r.sfra;
}
else if (min_time < max_time) {
- scene->r.sfra = static_cast<int>(round(min_time * FPS));
- scene->r.efra = static_cast<int>(round(max_time * FPS));
+ scene->r.sfra = int(round(min_time * FPS));
+ scene->r.efra = int(round(max_time * FPS));
scene->r.cfra = scene->r.sfra;
}
}
diff --git a/source/blender/io/usd/intern/usd_reader_curve.h b/source/blender/io/usd/intern/usd_reader_curve.h
index 1e9330b81f1..48fb2c5e2d1 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.h
+++ b/source/blender/io/usd/intern/usd_reader_curve.h
@@ -27,7 +27,7 @@ class USDCurvesReader : public USDGeomReader {
bool valid() const override
{
- return static_cast<bool>(curve_prim_);
+ return bool(curve_prim_);
}
void create_object(Main *bmain, double motionSampleTime) override;
diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.h b/source/blender/io/usd/intern/usd_reader_nurbs.h
index a5441aad3cf..aa3940dc540 100644
--- a/source/blender/io/usd/intern/usd_reader_nurbs.h
+++ b/source/blender/io/usd/intern/usd_reader_nurbs.h
@@ -27,7 +27,7 @@ class USDNurbsReader : public USDGeomReader {
bool valid() const override
{
- return static_cast<bool>(curve_prim_);
+ return bool(curve_prim_);
}
void create_object(Main *bmain, double motionSampleTime) override;
diff --git a/source/blender/io/usd/intern/usd_reader_volume.h b/source/blender/io/usd/intern/usd_reader_volume.h
index 350fae6ada0..923c3d140c9 100644
--- a/source/blender/io/usd/intern/usd_reader_volume.h
+++ b/source/blender/io/usd/intern/usd_reader_volume.h
@@ -23,7 +23,7 @@ class USDVolumeReader : public USDXformReader {
bool valid() const override
{
- return static_cast<bool>(volume_);
+ return bool(volume_);
}
void create_object(Main *bmain, double motionSampleTime) override;
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
index 9c1bc2f0f8f..2d4edd8979d 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
@@ -49,11 +49,11 @@ struct MTLTexMap {
struct MTLMaterial {
const MTLTexMap &tex_map_of_type(MTLTexMapType key) const
{
- return texture_maps[(int)key];
+ return texture_maps[int(key)];
}
MTLTexMap &tex_map_of_type(MTLTexMapType key)
{
- return texture_maps[(int)key];
+ return texture_maps[int(key)];
}
std::string name;
@@ -76,7 +76,7 @@ struct MTLMaterial {
float aniso_rot{-1.0f}; /* `anisor` */
int illum_mode{-1};
- MTLTexMap texture_maps[(int)MTLTexMapType::Count];
+ MTLTexMap texture_maps[int(MTLTexMapType::Count)];
/* Only used for Normal Map node: `map_Bump`. */
float normal_strength{-1.0f};
};
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
index 04d9a665588..91f09d9e188 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
+++ b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
@@ -110,7 +110,7 @@ struct Geometry {
int get_vertex_count() const
{
- return (int)vertices_.size();
+ return int(vertices_.size());
}
void track_vertex_index(int index)
{