Cleanup: USD/ABC, remove `const` from pass-by-value params

Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
This commit is contained in:
Sybren A. Stüvel 2022-01-06 11:37:51 +01:00
parent f9aa6376f1
commit ed3fecae8e
8 changed files with 21 additions and 23 deletions

View File

@ -50,9 +50,7 @@ bool BKE_cachefile_filepath_get(const struct Main *bmain,
const struct CacheFile *cache_file,
char r_filename[1024]);
float BKE_cachefile_time_offset(const struct CacheFile *cache_file,
const float time,
const float fps);
float BKE_cachefile_time_offset(const struct CacheFile *cache_file, float time, float fps);
/* Modifiers and constraints open and free readers through these. */
void BKE_cachefile_reader_open(struct CacheFile *cache_file,
@ -69,7 +67,7 @@ void BKE_cachefile_reader_free(struct CacheFile *cache_file, struct CacheReader
*/
bool BKE_cache_file_uses_render_procedural(const struct CacheFile *cache_file,
struct Scene *scene,
const int dag_eval_mode);
int dag_eval_mode);
#ifdef __cplusplus
}

View File

@ -115,16 +115,16 @@ void ABC_get_transform(struct CacheReader *reader,
struct Mesh *ABC_read_mesh(struct CacheReader *reader,
struct Object *ob,
struct Mesh *existing_mesh,
const float time,
float time,
const char **err_str,
const int read_flags,
int read_flags,
const char *velocity_name,
const float velocity_scale);
float velocity_scale);
bool ABC_mesh_topology_changed(struct CacheReader *reader,
struct Object *ob,
struct Mesh *existing_mesh,
const float time,
float time,
const char **err_str);
void ABC_CacheReader_incref(struct CacheReader *reader);

View File

@ -52,9 +52,9 @@ class AbcCurveReader final : public AbcObjectReader {
*/
struct Mesh *read_mesh(struct Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel,
const int read_flag,
int read_flag,
const char *velocity_name,
const float velocity_scale,
float velocity_scale,
const char **err_str) override;
void read_curve_sample(Curve *cu,

View File

@ -42,9 +42,9 @@ class AbcMeshReader final : public AbcObjectReader {
struct Mesh *read_mesh(struct Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel,
const int read_flag,
int read_flag,
const char *velocity_name,
const float velocity_scale,
float velocity_scale,
const char **err_str) override;
bool topology_changed(Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel) override;
@ -75,9 +75,9 @@ class AbcSubDReader final : public AbcObjectReader {
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override;
struct Mesh *read_mesh(struct Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel,
const int read_flag,
int read_flag,
const char *velocity_name,
const float velocity_scale,
float velocity_scale,
const char **err_str) override;
};

View File

@ -149,15 +149,15 @@ class AbcObjectReader {
virtual struct Mesh *read_mesh(struct Mesh *mesh,
const Alembic::Abc::ISampleSelector &sample_sel,
const int read_flag,
int read_flag,
const char *velocity_name,
const float velocity_scale,
float velocity_scale,
const char **err_str);
virtual bool topology_changed(Mesh *existing_mesh,
const Alembic::Abc::ISampleSelector &sample_sel);
/** Reads the object matrix and sets up an object transform if animated. */
void setupObjectTransform(const float time);
void setupObjectTransform(float time);
void addCacheModifier();
@ -168,13 +168,13 @@ class AbcObjectReader {
void incref();
void decref();
void read_matrix(float r_mat[4][4], const float time, const float scale, bool &is_constant);
void read_matrix(float r_mat[4][4], float time, float scale, bool &is_constant);
protected:
/** Determine whether we can inherit our parent's XForm. */
void determine_inherits_xform();
};
Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, const float time);
Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, float time);
} // namespace blender::io::alembic

View File

@ -45,7 +45,7 @@ class AbcPointsReader final : public AbcObjectReader {
const Alembic::Abc::ISampleSelector &sample_sel,
int read_flag,
const char *velocity_name,
const float velocity_scale,
float velocity_scale,
const char **err_str) override;
};

View File

@ -46,7 +46,7 @@ class USDXformReader : public USDPrimReader {
void create_object(Main *bmain, double motionSampleTime) override;
void read_object_data(Main *bmain, double motionSampleTime) override;
void read_matrix(float r_mat[4][4], const float time, const float scale, bool *r_is_constant);
void read_matrix(float r_mat[4][4], float time, float scale, bool *r_is_constant);
bool use_parent_xform() const
{

View File

@ -106,14 +106,14 @@ void USD_get_transform(struct CacheReader *reader, float r_mat[4][4], float time
struct Mesh *USD_read_mesh(struct CacheReader *reader,
struct Object *ob,
struct Mesh *existing_mesh,
const float time,
float time,
const char **err_str,
int read_flag);
bool USD_mesh_topology_changed(struct CacheReader *reader,
struct Object *ob,
struct Mesh *existing_mesh,
const float time,
float time,
const char **err_str);
struct CacheReader *CacheReader_open_usd_object(struct CacheArchiveHandle *handle,