Cleanup: add const qualifier

This adds a const qualifier to some code path in the Alembic and USD
importers. More could be added elsewhere. This change is done as it will
be required when GeometrySets are supported and helps keeping diff noise
in the patch to a bare minimum.
This commit is contained in:
Kévin Dietrich
2022-03-23 21:24:50 +01:00
parent 03a7747aa6
commit 945dfd200b
9 changed files with 13 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ struct Mesh *ABC_read_mesh(struct CacheReader *reader,
bool ABC_mesh_topology_changed(struct CacheReader *reader,
struct Object *ob,
struct Mesh *existing_mesh,
const struct Mesh *existing_mesh,
float time,
const char **err_str);

View File

@@ -658,7 +658,7 @@ bool AbcMeshReader::accepts_object_type(
return true;
}
bool AbcMeshReader::topology_changed(Mesh *existing_mesh, const ISampleSelector &sample_sel)
bool AbcMeshReader::topology_changed(const Mesh *existing_mesh, const ISampleSelector &sample_sel)
{
IPolyMeshSchema::Sample sample;
try {

View File

@@ -30,7 +30,7 @@ class AbcMeshReader final : public AbcObjectReader {
const char *velocity_name,
float velocity_scale,
const char **err_str) override;
bool topology_changed(Mesh *existing_mesh,
bool topology_changed(const Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel) override;
private:

View File

@@ -140,7 +140,7 @@ struct Mesh *AbcObjectReader::read_mesh(struct Mesh *existing_mesh,
return existing_mesh;
}
bool AbcObjectReader::topology_changed(Mesh * /*existing_mesh*/,
bool AbcObjectReader::topology_changed(const Mesh * /*existing_mesh*/,
const Alembic::Abc::ISampleSelector & /*sample_sel*/)
{
/* The default implementation of read_mesh() just returns the original mesh, so never changes the

View File

@@ -139,7 +139,7 @@ class AbcObjectReader {
const char *velocity_name,
float velocity_scale,
const char **err_str);
virtual bool topology_changed(Mesh *existing_mesh,
virtual bool topology_changed(const Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel);
/** Reads the object matrix and sets up an object transform if animated. */

View File

@@ -801,8 +801,11 @@ Mesh *ABC_read_mesh(CacheReader *reader,
existing_mesh, sample_sel, read_flag, velocity_name, velocity_scale, err_str);
}
bool ABC_mesh_topology_changed(
CacheReader *reader, Object *ob, Mesh *existing_mesh, const float time, const char **err_str)
bool ABC_mesh_topology_changed(CacheReader *reader,
Object *ob,
const Mesh *existing_mesh,
const float time,
const char **err_str)
{
AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str);
if (abc_reader == nullptr) {

View File

@@ -24,7 +24,7 @@ class USDGeomReader : public USDXformReader {
int read_flag,
const char **err_str) = 0;
virtual bool topology_changed(Mesh * /* existing_mesh */, double /* motionSampleTime */)
virtual bool topology_changed(const Mesh * /* existing_mesh */, double /* motionSampleTime */)
{
return true;
}

View File

@@ -232,7 +232,7 @@ bool USDMeshReader::valid() const
return static_cast<bool>(mesh_prim_);
}
bool USDMeshReader::topology_changed(Mesh *existing_mesh, const double motionSampleTime)
bool USDMeshReader::topology_changed(const Mesh *existing_mesh, const double motionSampleTime)
{
/* TODO(makowalski): Is it the best strategy to cache the mesh
* geometry in this function? This needs to be revisited. */

View File

@@ -53,7 +53,7 @@ class USDMeshReader : public USDGeomReader {
int read_flag,
const char **err_str) override;
bool topology_changed(Mesh *existing_mesh, double motionSampleTime) override;
bool topology_changed(const Mesh *existing_mesh, double motionSampleTime) override;
private:
void process_normals_vertex_varying(Mesh *mesh);