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-19 16:19:40 +0300 |
commit | 20a678f24075162cba1a8652a764c99ac2166be6 (patch) | |
tree | 5d92d43ca252a8a6cfad8dd566bd9c69283d8a14 /source/blender | |
parent | 29b46e4ef22bd83d315b3bb73fd626f4c178d2de (diff) |
CD_NORMAL support for mesh customdata caching.
Diffstat (limited to 'source/blender')
-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); |