[Bf-blender-cvs] [e1273f7] gooseberry: Customdata caching for CD_ORCO.
Lukas Tönne
noreply at git.blender.org
Wed Mar 25 18:58:10 CET 2015
Commit: e1273f7d7907d8aa8be0fac6a67c76d5cacc3411
Author: Lukas Tönne
Date: Wed Mar 25 18:44:56 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBe1273f7d7907d8aa8be0fac6a67c76d5cacc3411
Customdata caching for CD_ORCO.
===================================================================
M source/blender/pointcache/alembic/abc_customdata.cpp
===================================================================
diff --git a/source/blender/pointcache/alembic/abc_customdata.cpp b/source/blender/pointcache/alembic/abc_customdata.cpp
index a55270e..7451870 100644
--- a/source/blender/pointcache/alembic/abc_customdata.cpp
+++ b/source/blender/pointcache/alembic/abc_customdata.cpp
@@ -169,6 +169,14 @@ void write_sample<CD_ORIGSPACE>(CustomDataWriter *writer, OCompoundProperty &par
uv_prop[3].set(V2fArraySample(uv_data[3]));
}
+template <>
+void write_sample<CD_ORCO>(CustomDataWriter *writer, OCompoundProperty &parent, const std::string &name, void *data, int num_data)
+{
+ OV3fArrayProperty prop = writer->add_array_property<OV3fArrayProperty>(name, parent);
+
+ prop.set(OV3fArrayProperty::sample_type((V3f *)data, num_data));
+}
+
/* ------------------------------------------------------------------------- */
template <CustomDataType CDTYPE>
@@ -322,6 +330,20 @@ PTCReadSampleResult read_sample<CD_ORIGSPACE>(CustomDataReader *reader, ICompoun
return PTC_READ_SAMPLE_EXACT;
}
+template <>
+PTCReadSampleResult read_sample<CD_ORCO>(CustomDataReader *reader, ICompoundProperty &parent, const ISampleSelector &ss, const std::string &name, void *data, int num_data)
+{
+ IV3fArrayProperty prop = reader->add_array_property<IV3fArrayProperty>(name, parent);
+
+ V3fArraySamplePtr sample = prop.getValue(ss);
+
+ if (sample->size() != num_data)
+ return PTC_READ_SAMPLE_INVALID;
+
+ memcpy(data, sample->getData(), sizeof(V3f) * num_data);
+ return PTC_READ_SAMPLE_EXACT;
+}
+
/* ========================================================================= */
/* recursive template that handles dispatch by CD layer type */
More information about the Bf-blender-cvs
mailing list