diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-23 23:24:50 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-23 23:32:09 +0300 |
commit | 945dfd200b1fc58c63fd01c264d50911f26773a2 (patch) | |
tree | e68ec1a31280faee177be4f64a2f4dc542f38bea /source | |
parent | 03a7747aa6e624ce2dc894bf376a7ed93bf25bb4 (diff) |
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.
Diffstat (limited to 'source')
9 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index a9ade9b02fa..d0c10bd7f76 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -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); diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 1d00b55ca78..47f4dd2ea5d 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -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 { diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.h b/source/blender/io/alembic/intern/abc_reader_mesh.h index 9f871d260a7..f97525297b7 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.h +++ b/source/blender/io/alembic/intern/abc_reader_mesh.h @@ -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: diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc index 72aec8f4336..dac0890e7c5 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.cc +++ b/source/blender/io/alembic/intern/abc_reader_object.cc @@ -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 diff --git a/source/blender/io/alembic/intern/abc_reader_object.h b/source/blender/io/alembic/intern/abc_reader_object.h index d33eabfbee5..5898d1bd529 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.h +++ b/source/blender/io/alembic/intern/abc_reader_object.h @@ -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. */ diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 769285c247f..c9c982aad6c 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -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) { diff --git a/source/blender/io/usd/intern/usd_reader_geom.h b/source/blender/io/usd/intern/usd_reader_geom.h index 6dcad2ffac8..b73279250f2 100644 --- a/source/blender/io/usd/intern/usd_reader_geom.h +++ b/source/blender/io/usd/intern/usd_reader_geom.h @@ -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; } diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 1f97c7b48b3..646d1ba1fde 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -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. */ diff --git a/source/blender/io/usd/intern/usd_reader_mesh.h b/source/blender/io/usd/intern/usd_reader_mesh.h index fdd814f56d4..5e33ce8b5e8 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.h +++ b/source/blender/io/usd/intern/usd_reader_mesh.h @@ -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); |