[Bf-blender-cvs] [58877d6] master: Alembic: quiet compilation warnings on Windows.

Kévin Dietrich noreply at git.blender.org
Thu Dec 1 08:32:25 CET 2016


Commit: 58877d6d082d82185ca611b704364168e5984bd7
Author: Kévin Dietrich
Date:   Thu Dec 1 08:32:02 2016 +0100
Branches: master
https://developer.blender.org/rB58877d6d082d82185ca611b704364168e5984bd7

Alembic: quiet compilation warnings on Windows.

Most of them are harmless implicit conversions (e.g. Alembic deals with
doubles for storing time information when Blender uses both ints and
floats/doubles) or class/struct mismatch on forward declarations.

===================================================================

M	source/blender/alembic/intern/abc_camera.cc
M	source/blender/alembic/intern/abc_customdata.h
M	source/blender/alembic/intern/abc_exporter.cc
M	source/blender/alembic/intern/abc_mesh.cc
M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_object.h
M	source/blender/alembic/intern/abc_points.cc
M	source/blender/alembic/intern/abc_points.h
M	source/blender/alembic/intern/abc_util.cc
M	source/blender/alembic/intern/abc_util.h
M	source/blender/alembic/intern/alembic_capi.cc

===================================================================

diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc
index d5271e3..4f70b2a 100644
--- a/source/blender/alembic/intern/abc_camera.cc
+++ b/source/blender/alembic/intern/abc_camera.cc
@@ -138,11 +138,11 @@ void AbcCameraReader::readObjectData(Main *bmain, float time)
 		bcam->stereo.convergence_distance = convergence_plane.getValue(sample_sel);
 	}
 
-	const float lens = cam_sample.getFocalLength();
-	const float apperture_x = cam_sample.getHorizontalAperture();
-	const float apperture_y = cam_sample.getVerticalAperture();
-	const float h_film_offset = cam_sample.getHorizontalFilmOffset();
-	const float v_film_offset = cam_sample.getVerticalFilmOffset();
+	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 film_aspect = apperture_x / apperture_y;
 
 	bcam->lens = lens;
@@ -150,10 +150,10 @@ void AbcCameraReader::readObjectData(Main *bmain, float time)
 	bcam->sensor_y = apperture_y * 10;
 	bcam->shiftx = h_film_offset / apperture_x;
 	bcam->shifty = v_film_offset / apperture_y / film_aspect;
-	bcam->clipsta = max_ff(0.1f, cam_sample.getNearClippingPlane());
-	bcam->clipend = cam_sample.getFarClippingPlane();
-	bcam->gpu_dof.focus_distance = cam_sample.getFocusDistance();
-	bcam->gpu_dof.fstop = cam_sample.getFStop();
+	bcam->clipsta = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
+	bcam->clipend = static_cast<float>(cam_sample.getFarClippingPlane());
+	bcam->gpu_dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance());
+	bcam->gpu_dof.fstop = static_cast<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/alembic/intern/abc_customdata.h b/source/blender/alembic/intern/abc_customdata.h
index bc42e24..9e671fd 100644
--- a/source/blender/alembic/intern/abc_customdata.h
+++ b/source/blender/alembic/intern/abc_customdata.h
@@ -26,6 +26,7 @@
 #define __ABC_CUSTOMDATA_H__
 
 #include <Alembic/Abc/All.h>
+#include <Alembic/AbcGeom/All.h>
 
 struct CustomData;
 struct MLoop;
@@ -65,8 +66,8 @@ struct CDStreamConfig {
 
 	float weight;
 	float time;
-	int index;
-	int ceil_index;
+	Alembic::AbcGeom::index_t index;
+	Alembic::AbcGeom::index_t ceil_index;
 
 	CDStreamConfig()
 	    : mloop(NULL)
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index d259721..ff8b044 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -176,13 +176,13 @@ void AbcExporter::getShutterSamples(double step, bool time_relative,
 
 	/* sample all frame */
 	if (shutter_open == 0.0 && shutter_close == 1.0) {
-		for (double t = 0; t < 1.0; t += step) {
+		for (double t = 0.0; t < 1.0; t += step) {
 			samples.push_back((t + m_settings.frame_start) / time_factor);
 		}
 	}
 	else {
 		/* sample between shutter open & close */
-		const int nsamples = std::max((1.0 / step) - 1.0, 1.0);
+		const int nsamples = static_cast<int>(std::max((1.0 / step) - 1.0, 1.0));
 		const double time_inc = (shutter_close - shutter_open) / nsamples;
 
 		for (double t = shutter_open; t <= shutter_close; t += time_inc) {
@@ -217,7 +217,7 @@ void AbcExporter::getFrameSet(double step, std::set<double> &frames)
 
 	getShutterSamples(step, false, shutter_samples);
 
-	for (int frame = m_settings.frame_start; frame <= m_settings.frame_end; ++frame) {
+	for (double frame = m_settings.frame_start; frame <= m_settings.frame_end; frame += 1.0) {
 		for (int j = 0, e = shutter_samples.size(); j < e; ++j) {
 			frames.insert(frame + shutter_samples[j]);
 		}
@@ -238,9 +238,9 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled)
 	}
 
 	Scene *scene = m_scene;
-	const int fps = FPS;
+	const double fps = FPS;
 	char buf[16];
-	snprintf(buf, 15, "%d", fps);
+	snprintf(buf, 15, "%f", fps);
 	const std::string str_fps = buf;
 
 	Alembic::AbcCoreAbstract::MetaData md;
@@ -578,7 +578,7 @@ AbcTransformWriter *AbcExporter::getXForm(const std::string &name)
 
 void AbcExporter::setCurrentFrame(Main *bmain, double t)
 {
-	m_scene->r.cfra = std::floor(t);
-	m_scene->r.subframe = t - m_scene->r.cfra;
+	m_scene->r.cfra = static_cast<int>(t);
+	m_scene->r.subframe = static_cast<float>(t) - m_scene->r.cfra;
 	BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, m_scene, m_scene->lay);
 }
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 4fe1f2b..bdd75f9 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -952,7 +952,7 @@ static void read_mesh_sample(ImportSettings *settings,
 
 	if (config.weight != 0.0f) {
 		Alembic::AbcGeom::IPolyMeshSchema::Sample ceil_sample;
-		schema.get(ceil_sample, Alembic::Abc::ISampleSelector(static_cast<Alembic::AbcCoreAbstract::index_t>(config.ceil_index)));
+		schema.get(ceil_sample, Alembic::Abc::ISampleSelector(config.ceil_index));
 		abc_mesh_data.ceil_positions = ceil_sample.getPositions();
 	}
 
@@ -1186,7 +1186,7 @@ static void read_subd_sample(ImportSettings *settings,
 
 	if (config.weight != 0.0f) {
 		Alembic::AbcGeom::ISubDSchema::Sample ceil_sample;
-		schema.get(ceil_sample, Alembic::Abc::ISampleSelector(static_cast<Alembic::AbcCoreAbstract::index_t>(config.ceil_index)));
+		schema.get(ceil_sample, Alembic::Abc::ISampleSelector(config.ceil_index));
 		abc_mesh_data.ceil_positions = ceil_sample.getPositions();
 	}
 
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 314b256..9dfccdb 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -170,13 +170,13 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1,
 
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 4; ++j) {
-			mat0[i][j] = m0[i][j];
+			mat0[i][j] = static_cast<float>(m0[i][j]);
 		}
 	}
 
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 4; ++j) {
-			mat1[i][j] = m1[i][j];
+			mat1[i][j] = static_cast<float>(m1[i][j]);
 		}
 	}
 
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index d1bcbbe..0f733e6 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -76,7 +76,7 @@ private:
 
 /* ************************************************************************** */
 
-class CacheFile;
+struct CacheFile;
 
 struct ImportSettings {
 	bool do_convert_mat;
diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc
index 6ddba35..4c78f3e 100644
--- a/source/blender/alembic/intern/abc_points.cc
+++ b/source/blender/alembic/intern/abc_points.cc
@@ -189,7 +189,8 @@ void read_points_sample(const IPointsSchema &schema,
 	N3fArraySamplePtr vnormals;
 
 	if (has_property(prop, "N")) {
-		const IN3fArrayProperty &normals_prop = IN3fArrayProperty(prop, "N", time);
+		const Alembic::Util::uint32_t itime = static_cast<Alembic::Util::uint32_t>(time);
+		const IN3fArrayProperty &normals_prop = IN3fArrayProperty(prop, "N", itime);
 
 		if (normals_prop) {
 			vnormals = normals_prop.getValue(selector);
diff --git a/source/blender/alembic/intern/abc_points.h b/source/blender/alembic/intern/abc_points.h
index 792283f..cb68dbc 100644
--- a/source/blender/alembic/intern/abc_points.h
+++ b/source/blender/alembic/intern/abc_points.h
@@ -28,7 +28,7 @@
 #include "abc_object.h"
 #include "abc_customdata.h"
 
-class ParticleSystem;
+struct ParticleSystem;
 
 /* ************************************************************************** */
 
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 979a72f..f8ce72d 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -215,7 +215,7 @@ void convert_matrix(const Imath::M44d &xform, Object *ob,
 {
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 4; ++j) {
-			r_mat[i][j] = xform[i][j];
+			r_mat[i][j] = static_cast<float>(xform[i][j]);
 		}
 	}
 
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index 2f423a9..60a9685 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -39,7 +39,7 @@ struct CacheReader {
 using Alembic::Abc::chrono_t;
 
 class AbcObjectReader;
-class ImportSettings;
+struct ImportSettings;
 
 struct ID;
 struct Object;
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index d0eb990..d8d0171 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -625,8 +625,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
 			CFRA = SFRA;
 		}
 		else if (min_time < max_time) {
-			SFRA = min_time * FPS;
-			EFRA = max_time * FPS;
+			SFRA = static_cast<int>(min_time * FPS);
+			EFRA = static_cast<int>(max_time * FPS);
 			CFRA = SFRA;
 		}
 	}




More information about the Bf-blender-cvs mailing list