[Bf-blender-cvs] [abbd3d7] alembic_basic_io: Cleanup: namespace usage.

Kévin Dietrich noreply at git.blender.org
Wed Apr 6 20:42:04 CEST 2016


Commit: abbd3d795b8a8d1db9f570427dd6d0d47d322ed5
Author: Kévin Dietrich
Date:   Wed Apr 6 19:25:25 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBabbd3d795b8a8d1db9f570427dd6d0d47d322ed5

Cleanup: namespace usage.

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

M	source/blender/alembic/intern/abc_camera.cc
M	source/blender/alembic/intern/abc_camera.h
M	source/blender/alembic/intern/abc_exporter.cc
M	source/blender/alembic/intern/abc_hair.cc
M	source/blender/alembic/intern/abc_hair.h
M	source/blender/alembic/intern/abc_mesh.cc
M	source/blender/alembic/intern/abc_mesh.h
M	source/blender/alembic/intern/abc_nurbs.cc
M	source/blender/alembic/intern/abc_nurbs.h
M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_object.h
M	source/blender/alembic/intern/abc_shape.cc
M	source/blender/alembic/intern/abc_shape.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 7abe17e..0a3e2fc 100644
--- a/source/blender/alembic/intern/abc_camera.cc
+++ b/source/blender/alembic/intern/abc_camera.cc
@@ -39,21 +39,32 @@ extern "C" {
 #include "WM_types.h"
 }
 
+using Alembic::AbcGeom::ICamera;
+using Alembic::AbcGeom::ICompoundProperty;
+using Alembic::AbcGeom::IFloatProperty;
+using Alembic::AbcGeom::ISampleSelector;
+
+using Alembic::AbcGeom::OCamera;
+using Alembic::AbcGeom::OFloatProperty;
+
+using Alembic::AbcGeom::CameraSample;
+using Alembic::AbcGeom::kWrapExisting;
+
 AbcCameraWriter::AbcCameraWriter(Scene *sce, Object *obj,
                                  AbcTransformWriter *parent,
-                                 Alembic::Util::uint32_t timeSampling,
+                                 uint32_t timeSampling,
                                  AbcExportOptions &opts)
     : AbcShapeWriter(sce, obj, parent, timeSampling, opts)
 {
 	std::string name = get_object_name(m_object);
 	name.append("Shape");
 
-	Alembic::AbcGeom::OCamera camera(parent->alembicXform(), name, m_time_sampling);
+	OCamera camera(parent->alembicXform(), name, m_time_sampling);
 	m_camera_schema = camera.getSchema();
 
 	m_custom_data_container = m_camera_schema.getUserProperties();
-	m_stereo_distance = Alembic::AbcGeom::OFloatProperty(m_custom_data_container, "stereoDistance", m_time_sampling);
-	m_eye_separation  = Alembic::AbcGeom::OFloatProperty(m_custom_data_container, "eyeSeparation", m_time_sampling);
+	m_stereo_distance = OFloatProperty(m_custom_data_container, "stereoDistance", m_time_sampling);
+	m_eye_separation = OFloatProperty(m_custom_data_container, "eyeSeparation", m_time_sampling);
 }
 
 void AbcCameraWriter::do_write()
@@ -106,7 +117,7 @@ void AbcCameraWriter::do_write()
 AbcCameraReader::AbcCameraReader(const Alembic::Abc::IObject &object, int from_forward, int from_up)
     : AbcObjectReader(object, from_forward, from_up)
 {
-	Alembic::AbcGeom::ICamera abc_cam(m_iobject, Alembic::AbcGeom::kWrapExisting);
+	ICamera abc_cam(m_iobject, kWrapExisting);
 	m_schema = abc_cam.getSchema();
 }
 
@@ -119,27 +130,29 @@ void AbcCameraReader::readObjectData(Main *bmain, Scene *scene, float time)
 {
 	Camera *bcam = static_cast<Camera *>(BKE_camera_add(bmain, "abc_camera"));
 
-	Alembic::AbcGeom::ISampleSelector sample_sel(time);
-	Alembic::AbcGeom::CameraSample cam_sample;
+	ISampleSelector sample_sel(time);
+	CameraSample cam_sample;
 	m_schema.get(cam_sample, sample_sel);
 
-	Alembic::AbcGeom::ICompoundProperty customDataContainer =  m_schema.getUserProperties();
+	ICompoundProperty customDataContainer =  m_schema.getUserProperties();
 
-	if (customDataContainer.valid() && customDataContainer.getPropertyHeader("stereoDistance") &&
-	    customDataContainer.getPropertyHeader("eyeSeparation")) {
-		Alembic::AbcGeom::IFloatProperty convergence_plane(customDataContainer, "stereoDistance");
-		Alembic::AbcGeom::IFloatProperty eye_separation(customDataContainer, "eyeSeparation");
+	if (customDataContainer.valid() &&
+	    customDataContainer.getPropertyHeader("stereoDistance") &&
+	    customDataContainer.getPropertyHeader("eyeSeparation"))
+	{
+		IFloatProperty convergence_plane(customDataContainer, "stereoDistance");
+		IFloatProperty eye_separation(customDataContainer, "eyeSeparation");
 
 		bcam->stereo.interocular_distance = eye_separation.getValue(sample_sel);
 		bcam->stereo.convergence_distance = convergence_plane.getValue(sample_sel);;
 	}
 
-	float lens = cam_sample.getFocalLength();
-	float apperture_x = cam_sample.getHorizontalAperture();
-	float apperture_y = cam_sample.getVerticalAperture();
-	float h_film_offset = cam_sample.getHorizontalFilmOffset();
-	float v_film_offset = cam_sample.getVerticalFilmOffset();
-	float film_aspect = apperture_x / apperture_y;
+	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 film_aspect = apperture_x / apperture_y;
 
 	bcam->lens = lens;
 	bcam->sensor_x = apperture_x * 10;
diff --git a/source/blender/alembic/intern/abc_camera.h b/source/blender/alembic/intern/abc_camera.h
index 7f0e374..bb389e9 100644
--- a/source/blender/alembic/intern/abc_camera.h
+++ b/source/blender/alembic/intern/abc_camera.h
@@ -36,7 +36,7 @@ class AbcCameraWriter : public AbcShapeWriter {
 
 public:
 	AbcCameraWriter(Scene *sce, Object *obj, AbcTransformWriter *parent,
-	                Alembic::Util::uint32_t timeSampling,
+	                uint32_t timeSampling,
 	                AbcExportOptions &opts);
 
 private:
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 27dd7f1..ad618b4 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -112,7 +112,7 @@ Alembic::Abc::TimeSamplingPtr AbcExporter::createTimeSampling(int start, int end
 	}
 
 	getShutterSamples(shutterOpen, shutterClose, step, true, samples);
-	Alembic::Abc::TimeSamplingType ts(static_cast<Alembic::Util::uint32_t>(samples.size()), 1.0 / m_scene->r.frs_sec);
+	Alembic::Abc::TimeSamplingType ts(static_cast<uint32_t>(samples.size()), 1.0 / m_scene->r.frs_sec);
 	timeSampling.reset(new Alembic::Abc::TimeSampling(ts, samples));
 	return timeSampling;
 }
@@ -228,11 +228,11 @@ void AbcExporter::operator()()
 				xit->second->write();
 
 			/* Save the archive 's bounding box. */
-			Alembic::Abc::Box3d bounds;
+			Imath::Box3d bounds;
 
 			for (std::map<std::string, AbcTransformWriter*>::iterator xit = m_xforms.begin(), xe = m_xforms.end(); xit != xe; ++xit)
 			{
-				Alembic::Abc::Box3d box = xit->second->bounds();
+				Imath::Box3d box = xit->second->bounds();
 				bounds.extendBy(box);
 			}
 
diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc
index 9cf05be..72a6e24 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -34,10 +34,15 @@ extern "C" {
 #include "BKE_particle.h"
 }
 
+using Alembic::AbcGeom::OCurves;
+using Alembic::AbcGeom::OCurvesSchema;
+using Alembic::AbcGeom::ON3fGeomParam;
+using Alembic::AbcGeom::OV2fGeomParam;
+
 AbcHairWriter::AbcHairWriter(Scene *sce,
                              Object *obj,
                              AbcTransformWriter *parent,
-                             Alembic::Util::uint32_t timeSampling,
+                             uint32_t timeSampling,
                              AbcExportOptions &opts,
                              ParticleSystem *psys)
     : AbcShapeWriter(sce, obj, parent, timeSampling, opts)
@@ -48,7 +53,7 @@ AbcHairWriter::AbcHairWriter(Scene *sce,
 
 	m_is_animated = isAnimated();
 
-	Alembic::AbcGeom::OCurves curves(parent->alembicXform(), name, m_time_sampling);
+	OCurves curves(parent->alembicXform(), name, m_time_sampling);
 	m_curves_schema = curves.getSchema();
 }
 
@@ -95,10 +100,10 @@ void AbcHairWriter::do_write()
 		printf("Warning, no UV set found for underlying geometry\n");
 	}
 
-	std::vector<Alembic::AbcGeom::V3f> verts;
+	std::vector<Imath::V3f> verts;
 	std::vector<int32_t> hvertices;
-	std::vector<Alembic::AbcGeom::V2f> uv_values;
-	std::vector<Alembic::AbcGeom::N3f> norm_values;
+	std::vector<Imath::V2f> uv_values;
+	std::vector<Imath::V3f> norm_values;
 
 	const float nscale = 1.0f / 32767.0f;
 
@@ -120,10 +125,10 @@ void AbcHairWriter::do_write()
 
 					if (mface) {
 						psys_interpolate_uvs(tface, face->v4, pa->fuv, r_uv);
-						uv_values.push_back(Alembic::AbcGeom::V2f(r_uv[0], r_uv[1]));
+						uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
 
 						psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL, NULL);
-						norm_values.push_back(Alembic::AbcGeom::N3f(tmpnor[0],tmpnor[2], -tmpnor[1]));
+						norm_values.push_back(Imath::V3f(tmpnor[0],tmpnor[2], -tmpnor[1]));
 					}
 				}
 				else {
@@ -150,9 +155,9 @@ void AbcHairWriter::do_write()
 						}
 
 						if (vtx[o] == num) {
-							uv_values.push_back(Alembic::AbcGeom::V2f(tface->uv[o][0], tface->uv[o][1]));
+							uv_values.push_back(Imath::V2f(tface->uv[o][0], tface->uv[o][1]));
 							MVert *mv = mverts + vtx[o];
-							norm_values.push_back(Alembic::AbcGeom::N3f(mv->no[0] * nscale,
+							norm_values.push_back(Imath::V3f(mv->no[0] * nscale,
 							                      mv->no[1] * nscale, mv->no[2] * nscale));
 							found = true;
 							break;
@@ -177,7 +182,7 @@ void AbcHairWriter::do_write()
 					mul_m3_v3(m_options.convert_matrix, vert);
 				}
 
-				verts.push_back(Alembic::AbcGeom::V3f(vert[0], vert[1], vert[2]));
+				verts.push_back(Imath::V3f(vert[0], vert[1], vert[2]));
 
 				++path;
 			}
@@ -200,14 +205,14 @@ void AbcHairWriter::do_write()
 
 					if (mface && mtface) {
 						psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv);
-						uv_values.push_back(Alembic::AbcGeom::V2f(r_uv[0], r_uv[1]));
+						uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
 
 						psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL, NULL);
 						if (m_rotate_matrix) {
-							norm_values.push_back(Alembic::AbcGeom::N3f(tmpnor[0],tmpnor[2], -tmpnor[1]));
+							norm_values.push_back(Imath::V3f(tmpnor[0],tmpnor[2], -tmpnor[1]));
 						}
 						else {
-							norm_values.push_back(Alembic::AbcGeom::N3f(tmpnor[0],tmpnor[1], tmpnor[2]));
+							norm_values.push_back(Imath::V3f(tmpnor[0],tmpnor[1], tmpnor[2]));
 						}
 					}
 				}
@@ -219,7 +224,7 @@ void AbcHairWriter::do_write()
 					float vert[3];
 					copy_v3_v3(vert, path->co);
 					mul_m4_v3(inv_mat, vert);
-					verts.push_back(Alembic::AbcGeom::V3f(vert[0], vert[1], vert[2]));
+					verts.push_back(Imath::V3f(vert[0], vert[1], vert[2]));
 					++path;
 				}
 			}
@@ -229,16 +234,16 @@ void AbcHairWriter::do_write()
 	dm->release(dm);
 
 	Alembic::Abc::P3fArraySample iPos(verts);
-	m_curves_schema_sample = Alembic::AbcGeom::OCurvesSchema::Sample(iPos, hvertices);
+	m_c

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list