diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-14 18:48:31 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-14 18:48:31 +0300 |
commit | 66dc4d4efb88ecf2d18bfa08ab9c43b024ebd2fb (patch) | |
tree | 34f263d77b511f6344f1215073483d66d69689d4 /source/blender/io/alembic | |
parent | 45f30543db3c8f6898668907aa8088d434394be6 (diff) |
Cleanup: Alembic, use a structure to pass parameters
This adds a structure, `ABCReadParams`, to store some parameters passed
to `ABC_read_mesh` so we avoid passing too many parameters, and makes it
easier to add more parameters in the future without worrying about
argument order.
Differential Revision: https://developer.blender.org/D14484
Diffstat (limited to 'source/blender/io/alembic')
-rw-r--r-- | source/blender/io/alembic/ABC_alembic.h | 14 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/alembic_capi.cc | 17 |
2 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index d7d3adefc33..ded3258ff18 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -99,15 +99,19 @@ void ABC_get_transform(struct CacheReader *reader, double time, float scale); +typedef struct ABCReadParams { + double time; + int read_flags; + const char *velocity_name; + float velocity_scale; +} ABCReadParams; + /* Either modifies existing_mesh in-place or constructs a new mesh. */ struct Mesh *ABC_read_mesh(struct CacheReader *reader, struct Object *ob, struct Mesh *existing_mesh, - double time, - const char **err_str, - int read_flags, - const char *velocity_name, - float velocity_scale); + const ABCReadParams *params, + const char **err_str); bool ABC_mesh_topology_changed(struct CacheReader *reader, struct Object *ob, diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index fe459ce4370..0d4e1d04db0 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -785,20 +785,21 @@ static ISampleSelector sample_selector_for_time(chrono_t time) Mesh *ABC_read_mesh(CacheReader *reader, Object *ob, Mesh *existing_mesh, - const double time, - const char **err_str, - const int read_flag, - const char *velocity_name, - const float velocity_scale) + const ABCReadParams *params, + const char **err_str) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); if (abc_reader == nullptr) { return nullptr; } - ISampleSelector sample_sel = sample_selector_for_time(time); - return abc_reader->read_mesh( - existing_mesh, sample_sel, read_flag, velocity_name, velocity_scale, err_str); + ISampleSelector sample_sel = sample_selector_for_time(params->time); + return abc_reader->read_mesh(existing_mesh, + sample_sel, + params->read_flags, + params->velocity_name, + params->velocity_scale, + err_str); } bool ABC_mesh_topology_changed(CacheReader *reader, |