[Bf-blender-cvs] [d9ff78c] alembic_basic_io: Cleanups:
Kévin Dietrich
noreply at git.blender.org
Wed Jun 22 17:21:39 CEST 2016
Commit: d9ff78c406220d1cc8058cdb68e5a2f677a473d6
Author: Kévin Dietrich
Date: Wed Jun 22 16:18:47 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBd9ff78c406220d1cc8058cdb68e5a2f677a473d6
Cleanups:
- use C++ style cast
- member initialisation list
- remove leftover custom props code
- quiet some warnings from cppcheck
===================================================================
M source/blender/alembic/ABC_alembic.h
M source/blender/alembic/intern/abc_customdata.cc
M source/blender/alembic/intern/abc_export_options.cc
M source/blender/alembic/intern/abc_export_options.h
M source/blender/alembic/intern/abc_exporter.cc
M source/blender/alembic/intern/abc_hair.cc
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/alembic_capi.cc
M source/blender/editors/io/io_alembic.c
M source/blender/makesrna/intern/rna_scene_api.c
===================================================================
diff --git a/source/blender/alembic/ABC_alembic.h b/source/blender/alembic/ABC_alembic.h
index 9baa2d5..dabccdd 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -53,7 +53,6 @@ int ABC_export(struct Scene *scene, struct bContext *C, const char *filepath,
int vcolors,
int force_meshes,
int flatten_hierarchy,
- int custom_props_as_geodata,
int vislayers, int renderable,
int facesets, int matindices,
int geogroups, int compression,
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index ed197e2..c780a61 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -134,8 +134,8 @@ static void write_uv(const OCompoundProperty &prop, const CDStreamConfig &config
OV2fGeomParam param(prop, name, true, kFacevaryingScope, 1);
OV2fGeomParam::Sample sample(
- V2fArraySample((const Imath::V2f *)&uvs.front(), uvs.size()),
- UInt32ArraySample((const uint32_t *)&indices.front(), indices.size()),
+ V2fArraySample(&uvs.front(), uvs.size()),
+ UInt32ArraySample(&indices.front(), indices.size()),
kFacevaryingScope);
param.set(sample);
diff --git a/source/blender/alembic/intern/abc_export_options.cc b/source/blender/alembic/intern/abc_export_options.cc
index 675bf48..8c74972 100644
--- a/source/blender/alembic/intern/abc_export_options.cc
+++ b/source/blender/alembic/intern/abc_export_options.cc
@@ -34,77 +34,34 @@ extern "C" {
}
ExportSettings::ExportSettings()
- : scene(NULL)
-{
- selected_only = false;
- visible_layers_only = false;
- renderable_only = false;
-
- startframe = 1;
- endframe = 10;
- xform_frame_step = 1;
- shape_frame_step = 1;
- shutter_open = 0.0;
- shutter_close = 1.0;
- global_scale = 1.0f;
-
- flatten_hierarchy = false;
-
- export_normals = true;
- export_uvs = true;
- export_vcols = true;
- export_face_sets = false;
- export_mat_indices = false;
- export_vweigths = false;
-
- export_subsurfs_as_meshes = false;
- export_props_as_geo_params = true;
-}
-
-bool ExportSettings::exportTransform(Object *obj) const
-{
- return !isAbcRoot(obj);
-}
-
-bool ExportSettings::checkIsAbcRoot(Object *ob)
-{
- Object *parent = ob;
-
- while (parent) {
- if (isAbcRoot(parent)) {
- return true;
- }
-
- parent = parent->parent;
- }
-
- return false;
-}
-
-bool ExportSettings::isAbcRoot(Object *obj) const
-{
- ID *id = reinterpret_cast<ID *>(obj);
- IDProperty *xport_props = IDP_GetProperties(id, false);
-
- if (!xport_props) {
- return false;
- }
-
- IDProperty *enable_xport = IDP_GetPropertyFromGroup(xport_props, "isAbcRoot");
-
- if (enable_xport) {
- return true;
- }
-
- return false;
-}
+ : selected_only(false)
+ , visible_layers_only(false)
+ , renderable_only(false)
+ , startframe(1)
+ , endframe(1)
+ , xform_frame_step(1)
+ , shape_frame_step(1)
+ , shutter_open(0.0)
+ , shutter_close(1.0)
+ , global_scale(1.0f)
+ , flatten_hierarchy(false)
+ , export_normals(false)
+ , export_uvs(false)
+ , export_vcols(false)
+ , export_face_sets(false)
+ , export_mat_indices(false)
+ , export_vweigths(false)
+ , export_subsurfs_as_meshes(false)
+ , use_subdiv_schema(false)
+ , export_child_hairs(true)
+ , export_ogawa(true)
+ , pack_uv(false)
+ , do_convert_axis(false)
+ , scene(NULL)
+{}
bool ExportSettings::exportObject(Object *obj) const
{
- if (!exportTransform(obj)) {
- return false;
- }
-
if (selected_only && !parent_selected(obj)) {
return false;
}
diff --git a/source/blender/alembic/intern/abc_export_options.h b/source/blender/alembic/intern/abc_export_options.h
index 1d9b699..4d4af01 100644
--- a/source/blender/alembic/intern/abc_export_options.h
+++ b/source/blender/alembic/intern/abc_export_options.h
@@ -28,10 +28,7 @@ struct Scene;
struct ExportSettings {
ExportSettings();
- bool exportTransform(Object *obj) const;
- bool isAbcRoot(Object *obj) const;
bool exportObject(Object *obj) const;
- bool checkIsAbcRoot(Object *ob);
bool selected_only;
bool visible_layers_only;
@@ -54,7 +51,6 @@ struct ExportSettings {
bool export_vweigths;
bool export_subsurfs_as_meshes;
- bool export_props_as_geo_params;
bool use_subdiv_schema;
bool export_child_hairs;
bool export_ogawa;
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 16ab176..efe1c01 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -98,13 +98,17 @@ static bool object_is_shape(Object *ob)
AbcExporter::AbcExporter(Scene *scene, const char *filename, ExportSettings &settings)
: m_settings(settings)
, m_filename(filename)
+ , m_trans_sampling_index(0)
+ , m_shape_sampling_index(0)
, m_scene(scene)
{}
AbcExporter::~AbcExporter()
{
- for (std::map<std::string, AbcTransformWriter*>::iterator it = m_xforms.begin(), e = m_xforms.end(); it != e; ++it)
+ std::map<std::string, AbcTransformWriter*>::iterator it, e;
+ for (it = m_xforms.begin(), e = m_xforms.end(); it != e; ++it) {
delete it->second;
+ }
for (int i = 0, e = m_shapes.size(); i != e; ++i) {
delete m_shapes[i];
@@ -415,17 +419,14 @@ void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Object *ob, Object
createShapeWriter(ob, dupliObParent);
if (lb) {
- DupliObject *link = static_cast<DupliObject *>(lb->first);
- Object *dupliob = NULL;
-
- while (link) {
- dupliob = link->ob;
+ DupliObject *dupliob = static_cast<DupliObject *>(lb->first);
- if (link->type == OB_DUPLIGROUP) {
- exploreObject(eval_ctx, dupliob, ob);
+ while (dupliob) {
+ if (dupliob->type == OB_DUPLIGROUP) {
+ exploreObject(eval_ctx, dupliob->ob, ob);
}
- link = link->next;
+ dupliob = dupliob->next;
}
}
diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc
index 33f7dce..eeb29f7 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -189,7 +189,7 @@ void AbcHairWriter::write_hair_sample(DerivedMesh *dm,
/* iterate over all faces to find a corresponding underlying UV */
for (int n = 0; n < dm->getNumTessFaces(dm); ++n) {
- MFace *face = (MFace*)dm->getTessFaceData(dm, n, CD_MFACE);
+ MFace *face = static_cast<MFace *>(dm->getTessFaceData(dm, n, CD_MFACE));
MTFace *tface = mtface + n;
unsigned int vtx[4];
vtx[0] = face->v1;
@@ -331,8 +331,8 @@ void AbcCurveReader::readObjectData(Main *bmain, Scene *scene, float time)
for (size_t i = 0; i < hvertices->size(); ++i) {
const int steps = (*hvertices)[i];
- Nurb *nu = (Nurb *)MEM_callocN(sizeof(Nurb), "abc_getnurb");
- nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * steps, "abc_getnurb");
+ Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "abc_getnurb"));
+ nu->bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint) * steps, "abc_getnurb"));
nu->type = CU_NURBS;
nu->resolu = cu->resolu;
nu->resolv = cu->resolv;
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index b5c14df..b6b870b 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -101,15 +101,15 @@ using Alembic::AbcGeom::IN3fGeomParam;
/* NOTE: Alembic's polygon winding order is clockwise, to match with Renderman. */
-static void get_vertices(DerivedMesh *dm, std::vector<float> &points)
+static void get_vertices(DerivedMesh *dm, std::vector<Imath::V3f> &points)
{
points.clear();
- points.resize(dm->getNumVerts(dm) * 3);
+ points.resize(dm->getNumVerts(dm));
MVert *verts = dm->getVertArray(dm);
for (int i = 0, e = dm->getNumVerts(dm); i < e; ++i) {
- copy_zup_yup(&points[i * 3], verts[i].co);
+ copy_zup_yup(points[i].getValue(), verts[i].co);
}
}
@@ -182,7 +182,7 @@ void get_creases(DerivedMesh *dm,
lengths.resize(sharpnesses.size(), 2);
}
-static void get_vertex_normals(DerivedMesh *dm, std::vector<float> &normals)
+static void get_vertex_normals(DerivedMesh *dm, std::vector<Imath::V3f> &normals)
{
normals.clear();
normals.resize(dm->getNumVerts(dm) * 3);
@@ -192,11 +192,11 @@ static void get_vertex_normals(DerivedMesh *dm, std::vector<float> &normals)
for (int i = 0, e = dm->getNumVerts(dm); i < e; ++i) {
normal_short_to_float_v3(no, verts[i].no);
- copy_zup_yup(&normals[i * 3], no);
+ copy_zup_yup(normals[i].getValue(), no);
}
}
-static void get_loop_normals(DerivedMesh *dm, std::vector<float> &normals)
+static void get_loop_normals(DerivedMesh *dm, std::vector<Imath::V3f> &normals)
{
MPoly *mpoly = dm->getPolyArray(dm);
MPoly *mp = mpoly;
@@ -223,7 +223,7 @@ static void get_loop_normals(DerivedMesh *dm, std::vector<float> &normals)
for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) {
const int index = ml->v;
- copy_zup_yup(&normals[loop_index * 3], lnors[index]);
+ copy_zup_yup(normals[loop_index].getValue(), lnors[index]);
}
}
}
@@ -238,14 +238,14 @@ static void get_loop_normals(DerivedMesh *dm, std::vector<float> &normals)
BKE_mesh_calc_poly_normal(mp, ml - (mp->totloop - 1), verts, no);
for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) {
- copy_zup_yup(&normals[loop_index * 3], no);
+ copy_zup_yup(normals[loop_index].getValue(), no);
}
}
else {
/* Smooth shaded, use individual vert normals. */
for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) {
normal_short_to_float_v3(no, verts[ml->v].no);
- copy_zup_yup(&normals[loop_index * 3], no);
+ copy_zup_yup(normals[loop_index].getValue(), no);
}
}
}
@@ -397,7 +397,7 @@ void AbcMeshWriter::do_write()
void AbcMeshWriter::writeMesh(DerivedMesh *dm)
{
- std::vector<float> points, normals;
+ std::vector<Imath::V3f> points, normals;
std::vector<int32_t> poly_verts, loop_counts;
bool smooth_normal = false;
@@ -409,12 +409,9 @@ void AbcMeshWriter::writeMesh(DerivedMesh *dm)
writeCommonData(dm, m_mesh_schema);
}
- m_mesh_sample = OPolyMeshSchema::Sample(
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list