Alembic import: report object name in face color index out of bounds error
This commit is contained in:
parent
ac88a3942e
commit
f20d7bed14
|
@ -255,6 +255,7 @@ static void read_uvs(const CDStreamConfig &config, void *data,
|
|||
static size_t mcols_out_of_bounds_check(
|
||||
const size_t color_index,
|
||||
const size_t array_size,
|
||||
const std::string & iobject_full_name,
|
||||
const PropertyHeader &prop_header,
|
||||
bool &r_bounds_warning_given)
|
||||
{
|
||||
|
@ -263,8 +264,10 @@ static size_t mcols_out_of_bounds_check(
|
|||
}
|
||||
|
||||
if (!r_bounds_warning_given) {
|
||||
std::cerr << "Alembic import: color index out of bounds "
|
||||
"reading face colors for property "
|
||||
std::cerr << "Alembic: color index out of bounds "
|
||||
"reading face colors for object "
|
||||
<< iobject_full_name
|
||||
<< ", property "
|
||||
<< prop_header.getName() << std::endl;
|
||||
r_bounds_warning_given = true;
|
||||
}
|
||||
|
@ -272,7 +275,8 @@ static size_t mcols_out_of_bounds_check(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void read_custom_data_mcols(const ICompoundProperty &arbGeomParams,
|
||||
static void read_custom_data_mcols(const std::string & iobject_full_name,
|
||||
const ICompoundProperty &arbGeomParams,
|
||||
const PropertyHeader &prop_header,
|
||||
const CDStreamConfig &config,
|
||||
const Alembic::Abc::ISampleSelector &iss)
|
||||
|
@ -338,7 +342,8 @@ static void read_custom_data_mcols(const ICompoundProperty &arbGeomParams,
|
|||
color_index = mcols_out_of_bounds_check(
|
||||
is_facevarying ? face_index : mloop->v,
|
||||
c3f_ptr->size(),
|
||||
prop_header, bounds_warning_given);
|
||||
iobject_full_name, prop_header,
|
||||
bounds_warning_given);
|
||||
|
||||
const Imath::C3f &color = (*c3f_ptr)[color_index];
|
||||
cface->a = FTOCHAR(color[0]);
|
||||
|
@ -350,7 +355,8 @@ static void read_custom_data_mcols(const ICompoundProperty &arbGeomParams,
|
|||
color_index = mcols_out_of_bounds_check(
|
||||
is_facevarying ? face_index : mloop->v,
|
||||
c4f_ptr->size(),
|
||||
prop_header, bounds_warning_given);
|
||||
iobject_full_name, prop_header,
|
||||
bounds_warning_given);
|
||||
|
||||
const Imath::C4f &color = (*c4f_ptr)[color_index];
|
||||
cface->a = FTOCHAR(color[0]);
|
||||
|
@ -387,7 +393,10 @@ static void read_custom_data_uvs(const ICompoundProperty &prop,
|
|||
read_uvs(config, cd_data, sample.getVals(), sample.getIndices());
|
||||
}
|
||||
|
||||
void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &config, const Alembic::Abc::ISampleSelector &iss)
|
||||
void read_custom_data(const std::string & iobject_full_name,
|
||||
const ICompoundProperty &prop,
|
||||
const CDStreamConfig &config,
|
||||
const Alembic::Abc::ISampleSelector &iss)
|
||||
{
|
||||
if (!prop.valid()) {
|
||||
return;
|
||||
|
@ -417,7 +426,7 @@ void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &confi
|
|||
continue;
|
||||
}
|
||||
|
||||
read_custom_data_mcols(prop, prop_header, config, iss);
|
||||
read_custom_data_mcols(iobject_full_name, prop, prop_header, config, iss);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ void write_custom_data(const OCompoundProperty &prop,
|
|||
CustomData *data,
|
||||
int data_type);
|
||||
|
||||
void read_custom_data(const ICompoundProperty &prop,
|
||||
void read_custom_data(const std::string & iobject_full_name,
|
||||
const ICompoundProperty &prop,
|
||||
const CDStreamConfig &config,
|
||||
const Alembic::Abc::ISampleSelector &iss);
|
||||
|
||||
|
|
|
@ -943,7 +943,8 @@ static void get_weight_and_index(CDStreamConfig &config,
|
|||
config.ceil_index = i1;
|
||||
}
|
||||
|
||||
static void read_mesh_sample(ImportSettings *settings,
|
||||
static void read_mesh_sample(const std::string & iobject_full_name,
|
||||
ImportSettings *settings,
|
||||
const IPolyMeshSchema &schema,
|
||||
const ISampleSelector &selector,
|
||||
CDStreamConfig &config,
|
||||
|
@ -981,7 +982,8 @@ static void read_mesh_sample(ImportSettings *settings,
|
|||
}
|
||||
|
||||
if ((settings->read_flag & (MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)) != 0) {
|
||||
read_custom_data(schema.getArbGeomParams(), config, selector);
|
||||
read_custom_data(iobject_full_name,
|
||||
schema.getArbGeomParams(), config, selector);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1112,8 @@ DerivedMesh *AbcMeshReader::read_derivedmesh(DerivedMesh *dm,
|
|||
config.time = sample_sel.getRequestedTime();
|
||||
|
||||
bool do_normals = false;
|
||||
read_mesh_sample(&settings, m_schema, sample_sel, config, do_normals);
|
||||
read_mesh_sample(m_iobject.getFullName(),
|
||||
&settings, m_schema, sample_sel, config, do_normals);
|
||||
|
||||
if (new_dm) {
|
||||
/* Check if we had ME_SMOOTH flag set to restore it. */
|
||||
|
@ -1217,7 +1220,8 @@ ABC_INLINE MEdge *find_edge(MEdge *edges, int totedge, int v1, int v2)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void read_subd_sample(ImportSettings *settings,
|
||||
static void read_subd_sample(const std::string & iobject_full_name,
|
||||
ImportSettings *settings,
|
||||
const ISubDSchema &schema,
|
||||
const ISampleSelector &selector,
|
||||
CDStreamConfig &config)
|
||||
|
@ -1252,7 +1256,8 @@ static void read_subd_sample(ImportSettings *settings,
|
|||
}
|
||||
|
||||
if ((settings->read_flag & (MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)) != 0) {
|
||||
read_custom_data(schema.getArbGeomParams(), config, selector);
|
||||
read_custom_data(iobject_full_name,
|
||||
schema.getArbGeomParams(), config, selector);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1382,7 +1387,8 @@ DerivedMesh *AbcSubDReader::read_derivedmesh(DerivedMesh *dm,
|
|||
/* Only read point data when streaming meshes, unless we need to create new ones. */
|
||||
CDStreamConfig config = get_config(new_dm ? new_dm : dm);
|
||||
config.time = sample_sel.getRequestedTime();
|
||||
read_subd_sample(&settings, m_schema, sample_sel, config);
|
||||
read_subd_sample(m_iobject.getFullName(),
|
||||
&settings, m_schema, sample_sel, config);
|
||||
|
||||
if (new_dm) {
|
||||
/* Check if we had ME_SMOOTH flag set to restore it. */
|
||||
|
|
Loading…
Reference in New Issue