Commit: 179acf028cb8fc8ec1ff21670b6d0150361940e4
Author: Lukas Tönne
Date: Sat May 30 13:25:22 2015 +0200
Branches: alembic
https://developer.blender.org/rB179acf028cb8fc8ec1ff21670b6d0150361940e4
Use the Alembic generic chrono_t type internally for reading from
archives, instead of Blender frame values.
This is easier to use for interpolation, the frame value is really only
required externally, before and after reading a sample.
===================================================================
M source/blender/pointcache/alembic/abc_cloth.cpp
M source/blender/pointcache/alembic/abc_cloth.h
M source/blender/pointcache/alembic/abc_group.cpp
M source/blender/pointcache/alembic/abc_group.h
M source/blender/pointcache/alembic/abc_mesh.cpp
M source/blender/pointcache/alembic/abc_mesh.h
M source/blender/pointcache/alembic/abc_object.cpp
M source/blender/pointcache/alembic/abc_object.h
M source/blender/pointcache/alembic/abc_particles.cpp
M source/blender/pointcache/alembic/abc_particles.h
M source/blender/pointcache/alembic/abc_reader.cpp
M source/blender/pointcache/alembic/abc_reader.h
M source/blender/pointcache/alembic/abc_simdebug.cpp
M source/blender/pointcache/alembic/abc_simdebug.h
===================================================================
diff --git a/source/blender/pointcache/alembic/abc_cloth.cpp
b/source/blender/pointcache/alembic/abc_cloth.cpp
index 6d8c86c..a722bc2 100644
--- a/source/blender/pointcache/alembic/abc_cloth.cpp
+++ b/source/blender/pointcache/alembic/abc_cloth.cpp
@@ -193,7 +193,7 @@ static void apply_sample_goal_positions(Cloth *cloth,
P3fArraySamplePtr sample)
}
}
-PTCReadSampleResult AbcClothReader::read_sample_abc(float frame)
+PTCReadSampleResult AbcClothReader::read_sample_abc(chrono_t time)
{
Cloth *cloth = m_clmd->clothObject;
@@ -203,14 +203,8 @@ PTCReadSampleResult AbcClothReader::read_sample_abc(float
frame)
IPointsSchema &schema = m_points.getSchema();
if (schema.getNumSamples() == 0)
return PTC_READ_SAMPLE_INVALID;
- TimeSamplingPtr ts = schema.getTimeSampling();
- ISampleSelector ss = abc_archive()->get_frame_sample_selector(frame);
-// chrono_t time = ss.getRequestedTime();
-
-// std::pair<index_t, chrono_t> sres = ts->getFloorIndex(time,
schema.getNumSamples());
-// chrono_t stime = sres.second;
-// float sframe = archive()->time_to_frame(stime);
+ ISampleSelector ss = get_frame_sample_selector(time);
IPointsSchema::Sample sample;
schema.get(sample, ss);
diff --git a/source/blender/pointcache/alembic/abc_cloth.h
b/source/blender/pointcache/alembic/abc_cloth.h
index da8ebf5..9b30b18 100644
--- a/source/blender/pointcache/alembic/abc_cloth.h
+++ b/source/blender/pointcache/alembic/abc_cloth.h
@@ -55,7 +55,7 @@ public:
void init_abc(Abc::IObject parent);
- PTCReadSampleResult read_sample_abc(float frame);
+ PTCReadSampleResult read_sample_abc(chrono_t time);
private:
AbcGeom::IPoints m_points;
diff --git a/source/blender/pointcache/alembic/abc_group.cpp
b/source/blender/pointcache/alembic/abc_group.cpp
index f38b7a8..b45b0b3 100644
--- a/source/blender/pointcache/alembic/abc_group.cpp
+++ b/source/blender/pointcache/alembic/abc_group.cpp
@@ -97,7 +97,7 @@ void AbcGroupReader::init_abc(IObject object)
m_abc_object = object;
}
-PTCReadSampleResult AbcGroupReader::read_sample_abc(float /*frame*/)
+PTCReadSampleResult AbcGroupReader::read_sample_abc(chrono_t /*time*/)
{
if (!m_abc_object)
return PTC_READ_SAMPLE_INVALID;
@@ -400,7 +400,7 @@ void AbcDupliCacheReader::init_abc(IObject /*object*/)
{
}
-void AbcDupliCacheReader::read_dupligroup_object(IObject object, float frame)
+void AbcDupliCacheReader::read_dupligroup_object(IObject object, chrono_t time)
{
if (GS(object.getName().c_str()) == ID_OB) {
/* instances are handled later, we create true object data here
*/
@@ -425,7 +425,7 @@ void AbcDupliCacheReader::read_dupligroup_object(IObject
object, float frame)
AbcDerivedMeshReader dm_reader("mesh", b_ob);
dm_reader.init(abc_archive());
dm_reader.init_abc(child);
- if (dm_reader.read_sample_abc(frame) !=
PTC_READ_SAMPLE_INVALID) {
+ if (dm_reader.read_sample_abc(time) !=
PTC_READ_SAMPLE_INVALID) {
BKE_dupli_object_data_set_mesh(dupli_data, dm_reader.acquire_result());
}
else {
@@ -440,7 +440,7 @@ void AbcDupliCacheReader::read_dupligroup_object(IObject
object, float frame)
AbcStrandsReader strands_reader(strands,
children, m_read_strands_motion, m_read_strands_children);
strands_reader.init(abc_archive());
strands_reader.init_abc(child);
- if (strands_reader.read_sample_abc(frame) !=
PTC_READ_SAMPLE_INVALID) {
+ if (strands_reader.read_sample_abc(time) !=
PTC_READ_SAMPLE_INVALID) {
Strands *newstrands =
strands_reader.acquire_result();
if (strands && strands != newstrands) {
/* reader can replace strands
internally if topology does not match */
@@ -464,8 +464,10 @@ void AbcDupliCacheReader::read_dupligroup_object(IObject
object, float frame)
}
}
-void AbcDupliCacheReader::read_dupligroup_group(IObject abc_group, const
ISampleSelector &ss)
+void AbcDupliCacheReader::read_dupligroup_group(IObject abc_group, chrono_t
time)
{
+ ISampleSelector ss = get_frame_sample_selector(time);
+
if (GS(abc_group.getName().c_str()) == ID_GR) {
size_t num_child = abc_group.getNumChildren();
@@ -493,10 +495,8 @@ void AbcDupliCacheReader::read_dupligroup_group(IObject
abc_group, const ISample
}
}
-PTCReadSampleResult AbcDupliCacheReader::read_sample_abc(float frame)
+PTCReadSampleResult AbcDupliCacheReader::read_sample_abc(chrono_t time)
{
- ISampleSelector ss = abc_archive()->get_frame_sample_selector(frame);
-
IObject abc_top = abc_archive()->root();
IObject abc_group = abc_archive()->get_id_object((ID *)m_group);
if (!abc_group)
@@ -504,13 +504,13 @@ PTCReadSampleResult
AbcDupliCacheReader::read_sample_abc(float frame)
/* first create shared object data */
for (size_t i = 0; i < abc_top.getNumChildren(); ++i) {
- read_dupligroup_object(abc_top.getChild(i), frame);
+ read_dupligroup_object(abc_top.getChild(i), time);
}
BKE_dupli_cache_clear_instances(dupli_cache);
/* now generate dupli instances for the group */
- read_dupligroup_group(abc_group, ss);
+ read_dupligroup_group(abc_group, time);
// XXX reader init is a mess ...
if (m_simdebug_reader) {
@@ -518,7 +518,7 @@ PTCReadSampleResult
AbcDupliCacheReader::read_sample_abc(float frame)
m_simdebug_reader->init(abc_archive());
m_simdebug_reader->init_abc(abc_top.getChild("sim_debug"));
- m_simdebug_reader->read_sample_abc(frame);
+ m_simdebug_reader->read_sample_abc(time);
}
}
@@ -686,7 +686,7 @@ void AbcDupliObjectReader::init_abc(IObject object)
m_abc_object = object;
}
-void AbcDupliObjectReader::read_dupligroup_object(IObject object, float frame)
+void AbcDupliObjectReader::read_dupligroup_object(IObject object, chrono_t
time)
{
if (GS(object.getName().c_str()) == ID_OB) {
/* instances are handled later, we create true object data here
*/
@@ -703,7 +703,7 @@ void AbcDupliObjectReader::read_dupligroup_object(IObject
object, float frame)
AbcDerivedMeshReader dm_reader("mesh", m_ob);
dm_reader.init(abc_archive());
dm_reader.init_abc(child);
- if (dm_reader.read_sample_abc(frame) !=
PTC_READ_SAMPLE_INVALID) {
+ if (dm_reader.read_sample_abc(time) !=
PTC_READ_SAMPLE_INVALID) {
BKE_dupli_object_data_set_mesh(dupli_data, dm_reader.acquire_result());
}
else {
@@ -718,7 +718,7 @@ void AbcDupliObjectReader::read_dupligroup_object(IObject
object, float frame)
AbcStrandsReader strands_reader(strands,
children, m_read_strands_motion, m_read_strands_children);
strands_reader.init(abc_archive());
strands_reader.init_abc(child);
- if (strands_reader.read_sample_abc(frame) !=
PTC_READ_SAMPLE_INVALID) {
+ if (strands_reader.read_sample_abc(time) !=
PTC_READ_SAMPLE_INVALID) {
Strands *newstrands =
strands_reader.acquire_result();
if (strands && strands != newstrands) {
/* reader can replace strands
internally if topology does not match */
@@ -742,12 +742,12 @@ void AbcDupliObjectReader::read_dupligroup_object(IObject
object, float frame)
}
}
-PTCReadSampleResult AbcDupliObjectReader::read_sample_abc(float frame)
+PTCReadSampleResult AbcDupliObjectReader::read_sample_abc(chrono_t time)
{
if (!m_abc_object)
return PTC_READ_SAMPLE_INVALID;
- read_dupligroup_object(m_abc_object, frame);
+ read_dupligroup_object(m_abc_object, time);
return PTC_READ_SAMPLE_EXACT;
}
diff --git a/source/blender/pointcache/alembic/abc_group.h
b/source/blender/pointcache/alembic/abc_group.h
index cf09163..ae8c58e 100644
--- a/source/blender/pointcache/alembic/abc_group.h
+++ b/source/blender/pointcache/alembic/abc_group.h
@@ -61,7 +61,7 @@ public:
void init_abc(Abc::IObject object);
- PTCReadSampleResult read_sample_abc(float frame);
+ PTCReadSampleResult read_sample_abc(chrono_t time);
private:
Abc::IObject m_abc_object;
@@ -145,11 +145,11 @@ public:
void init_abc(Abc::IObject object);
- PTCReadSampleResult read_sample_abc(float frame);
+ PTCReadSampleResult read_sample_abc(chrono_t time);
protected:
- void read_dupligroup_object(Abc::IObject object, float frame);
- void read_dupligroup_group(Abc::IObject abc_group, const
Abc::ISampleSelector &ss);
+ void read_dupligroup_object(Abc::IObject object, chrono_t time);
+ void read_dupligroup_group(Abc::IObject abc_group, chrono_t time);
DupliObjectData *find_dupli_data(Abc::ObjectReaderPtr ptr) const;
void insert_dupli_data(Abc::ObjectReaderPtr ptr, DupliObjectData *data);
@@ -205,10 +205,10 @@ public:
void init(ReaderArchive *archive);
void init_abc(Abc::IObject object);
- PTCReadSampleResult read_sample_abc(float frame);
+ PTCReadSampleResult read_sample_abc(chrono_t time);
protected:
- void read_dupligroup_object(Abc::IObject object, float frame);
+ void read_dupligroup_object(Abc::IObject object, chrono_t time);
DupliObjectData *find_dupli_data(Abc::ObjectReaderPtr ptr) const;
void insert_dupli_data(Abc::ObjectReaderPtr ptr, DupliObjectData *data);
diff --git a/source/blender/pointcache/alembic/abc_mesh.cpp
b/source/blender/pointcache/alembic/abc_mesh.cpp
index b670f35..3923e4f 100644
--- a/source/blender/pointcache/alembic/abc_mesh.cpp
+++ b/source/blender/pointcache/alembic/abc_mesh.cpp
@@ -500,7 +500,7 @@ static PTCReadSampleResult apply_sample_loops(DerivedMesh
*dm, Int32ArraySampleP
return PTC_READ_SAMPLE_EXACT;
}
-PTCReadSampleResult AbcDerivedMeshReader::read_sample_abc(float frame)
+PTCReadSampleResult AbcDerivedMeshReader::read_sample_abc(chrono_t time)
{
#ifdef USE_TIMING
double start_time;
@@ -526,7 +526,7 @@ PTCReadSampleResult
AbcDerivedMeshReader::read_sample_abc(float frame)
return PTC_READ_SAMPLE_INVALID;
ICompoundProperty user_props = schema.getUserProperties();
- ISampleSelector ss = abc_archive()->get_frame_sample_selector(frame);
+ ISampleSelector ss = get_frame_sample_selector(time);
PROFILE_START;
IPolyMeshSchema::Sample sample;
diff --git a/source/blender/pointcache/alembic/abc_mesh.h
b/source/blender/pointcache/alembic/abc_mesh.h
index fe38cbd..e00ccc3 100644
--- a/source/blender/pointcache/alembic/abc_mesh.h
+++ b/source/blender/pointcache/alembic/abc_mesh.h
@@ -85,7 +85,7 @@ public:
void init_abc(Abc::IObject object);
- PTCReadSampleResult read_sample_abc(float frame);
+ PTCRead
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs