diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-19 16:19:40 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-26 16:13:40 +0300 |
commit | e0f3d9250acb8d261f3aeb4c05ddd0ef256a9b1e (patch) | |
tree | d0c555f08d8a55a33e744bd353ecfd72fd795122 /source | |
parent | 640e3fd365a528ac05241037b5e85a35b842f7b2 (diff) |
CD_NORMAL support for mesh customdata caching.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/pointcache/alembic/abc_customdata.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/pointcache/alembic/abc_customdata.cpp b/source/blender/pointcache/alembic/abc_customdata.cpp index 145e19b8090..6f60a7fa7ef 100644 --- a/source/blender/pointcache/alembic/abc_customdata.cpp +++ b/source/blender/pointcache/alembic/abc_customdata.cpp @@ -133,6 +133,14 @@ void write_sample<CD_ORIGINDEX>(CustomDataWriter *writer, OCompoundProperty &par } template <> +void write_sample<CD_NORMAL>(CustomDataWriter *writer, OCompoundProperty &parent, const std::string &name, void *data, int num_data) +{ + ON3fArrayProperty prop = writer->add_array_property<ON3fArrayProperty>(name, parent); + + prop.set(ON3fArrayProperty::sample_type((N3f *)data, num_data)); +} + +template <> void write_sample<CD_ORIGSPACE>(CustomDataWriter *writer, OCompoundProperty &parent, const std::string &name, void *data, int num_data) { OCompoundProperty prop = writer->add_compound_property<OCompoundProperty>(name, parent); @@ -258,6 +266,20 @@ PTCReadSampleResult read_sample<CD_ORIGINDEX>(CustomDataReader *reader, ICompoun } template <> +PTCReadSampleResult read_sample<CD_NORMAL>(CustomDataReader *reader, ICompoundProperty &parent, const ISampleSelector &ss, const std::string &name, void *data, int num_data) +{ + IN3fArrayProperty prop = reader->add_array_property<IN3fArrayProperty>(name, parent); + + N3fArraySamplePtr sample = prop.getValue(ss); + + if (sample->size() != num_data) + return PTC_READ_SAMPLE_INVALID; + + memcpy(data, sample->getData(), sizeof(N3f) * num_data); + return PTC_READ_SAMPLE_EXACT; +} + +template <> PTCReadSampleResult read_sample<CD_ORIGSPACE>(CustomDataReader *reader, ICompoundProperty &parent, const ISampleSelector &ss, const std::string &name, void *data, int num_data) { ICompoundProperty prop = reader->add_compound_property<ICompoundProperty>(name, parent); |