[Bf-blender-cvs] [96e068d3aa9] master: Alembic: split up read_custom_data_ex() into read_custom_data_{mcols, uvs}()
Sybren A. Stüvel
noreply at git.blender.org
Tue May 23 17:29:12 CEST 2017
Commit: 96e068d3aa916bcc8152aedffafe1f8ddd7d27a1
Author: Sybren A. Stüvel
Date: Tue May 23 13:28:38 2017 +0200
Branches: master
https://developer.blender.org/rB96e068d3aa916bcc8152aedffafe1f8ddd7d27a1
Alembic: split up read_custom_data_ex() into read_custom_data_{mcols,uvs}()
The read_custom_data_ex() function was basically two functions inside
if/else bodies.
===================================================================
M source/blender/alembic/intern/abc_customdata.cc
===================================================================
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index 0d11ab79ddd..5fa3d10fa16 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -294,57 +294,59 @@ static void read_uvs(const CDStreamConfig &config, void *data,
}
}
-static void read_custom_data_ex(const ICompoundProperty &prop,
- const PropertyHeader &prop_header,
- const CDStreamConfig &config,
- const Alembic::Abc::ISampleSelector &iss,
- int data_type)
+static void read_custom_data_mcols(const ICompoundProperty &prop,
+ const PropertyHeader &prop_header,
+ const CDStreamConfig &config,
+ const Alembic::Abc::ISampleSelector &iss)
{
- if (data_type == CD_MLOOPCOL) {
- C3fArraySamplePtr c3f_ptr = C3fArraySamplePtr();
- C4fArraySamplePtr c4f_ptr = C4fArraySamplePtr();
+ C3fArraySamplePtr c3f_ptr = C3fArraySamplePtr();
+ C4fArraySamplePtr c4f_ptr = C4fArraySamplePtr();
- if (IC3fGeomParam::matches(prop_header)) {
- IC3fGeomParam color_param(prop, prop_header.getName());
- IC3fGeomParam::Sample sample;
- color_param.getIndexed(sample, iss);
+ if (IC3fGeomParam::matches(prop_header)) {
+ IC3fGeomParam color_param(prop, prop_header.getName());
+ IC3fGeomParam::Sample sample;
+ color_param.getIndexed(sample, iss);
- c3f_ptr = sample.getVals();
- }
- else if (IC4fGeomParam::matches(prop_header)) {
- IC4fGeomParam color_param(prop, prop_header.getName());
- IC4fGeomParam::Sample sample;
- color_param.getIndexed(sample, iss);
-
- c4f_ptr = sample.getVals();
- }
-
- void *cd_data = config.add_customdata_cb(config.user_data,
- prop_header.getName().c_str(),
- data_type);
+ c3f_ptr = sample.getVals();
+ }
+ else if (IC4fGeomParam::matches(prop_header)) {
+ IC4fGeomParam color_param(prop, prop_header.getName());
+ IC4fGeomParam::Sample sample;
+ color_param.getIndexed(sample, iss);
- read_mcols(config, cd_data, c3f_ptr, c4f_ptr);
+ c4f_ptr = sample.getVals();
}
- else if (data_type == CD_MLOOPUV) {
- IV2fGeomParam uv_param(prop, prop_header.getName());
- if (!uv_param.isIndexed()) {
- return;
- }
+ void *cd_data = config.add_customdata_cb(config.user_data,
+ prop_header.getName().c_str(),
+ CD_MLOOPCOL);
- IV2fGeomParam::Sample sample;
- uv_param.getIndexed(sample, iss);
+ read_mcols(config, cd_data, c3f_ptr, c4f_ptr);
+}
- if (uv_param.getScope() != kFacevaryingScope) {
- return;
- }
+static void read_custom_data_uvs(const ICompoundProperty &prop,
+ const PropertyHeader &prop_header,
+ const CDStreamConfig &config,
+ const Alembic::Abc::ISampleSelector &iss)
+{
+ IV2fGeomParam uv_param(prop, prop_header.getName());
+
+ if (!uv_param.isIndexed()) {
+ return;
+ }
- void *cd_data = config.add_customdata_cb(config.user_data,
- prop_header.getName().c_str(),
- data_type);
+ IV2fGeomParam::Sample sample;
+ uv_param.getIndexed(sample, iss);
- read_uvs(config, cd_data, sample.getVals(), sample.getIndices());
+ if (uv_param.getScope() != kFacevaryingScope) {
+ return;
}
+
+ void *cd_data = config.add_customdata_cb(config.user_data,
+ prop_header.getName().c_str(),
+ CD_MLOOPUV);
+
+ read_uvs(config, cd_data, sample.getVals(), sample.getIndices());
}
void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &config, const Alembic::Abc::ISampleSelector &iss)
@@ -367,7 +369,7 @@ void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &confi
continue;
}
- read_custom_data_ex(prop, prop_header, config, iss, CD_MLOOPUV);
+ read_custom_data_uvs(prop, prop_header, config, iss);
continue;
}
@@ -377,7 +379,7 @@ void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &confi
continue;
}
- read_custom_data_ex(prop, prop_header, config, iss, CD_MLOOPCOL);
+ read_custom_data_mcols(prop, prop_header, config, iss);
continue;
}
}
More information about the Bf-blender-cvs
mailing list