Querying start/end frame in an Alembic file

453 views
Skip to first unread message

Nicholas Yue

unread,
Sep 14, 2016, 6:18:17 PM9/14/16
to alembic-d...@googlegroups.com
Hi,

  In C++, what are the ways to query the start and end frame of an animated geometry in an Alembic file?

Cheers

Alex Suter

unread,
Sep 14, 2016, 6:42:24 PM9/14/16
to alembic-d...@googlegroups.com
Something like this often works:

float fps = 24.0;
ISubDSchema schema = ...;

Alembic::AbcAbstract::TimeSamplingPtr ts = schema.getTimeSampling();
int numSamples = schema.getNumSamples();

float startTime = ts->getSampleTime(0);
float endTime = ts->getSampleTime(numSamples - 1);

float startFrame = startTime * fps;
float endFrame = endTime * fps;

It gets complicated for a number of reasons. Different objects in the cache could have different TimeSampling objects, they can be cyclic, acyclic, etc.

I've heard of people having success with just storing the start and end frames on their own as attributes, but that's pipeline specific.


--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discussion+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lucas Miller

unread,
Sep 14, 2016, 6:49:40 PM9/14/16
to alembic-d...@googlegroups.com
You can loop over the archives time samplings with the help of:

IArchive::getNumTimeSamplings
and
IArchive::getTimeSampling

And determine the maximum number of samples per time sampling via:
IArchive::getMaxNumSamplesForTimeSamplingIndex

Remember to skip the archive time sampling at 0. (default time sampling)

For more info see the functions near:
https://github.com/alembic/alembic/blob/master/lib/Alembic/Abc/IArchive.h#L150

Lucas
>> email to alembic-discuss...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "alembic-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to alembic-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages