17#include <Alembic/AbcGeom/ILight.h>
18#include <Alembic/AbcGeom/INuPatch.h>
19#include <Alembic/AbcMaterial/IMaterial.h>
25using Alembic::Abc::IV3fArrayProperty;
26using Alembic::Abc::PropertyHeader;
27using Alembic::Abc::V3fArraySamplePtr;
33 return name == propNameOriginalCoordinates;
38 std::string abc_name(name);
39 std::replace(abc_name.begin(), abc_name.end(),
' ',
'_');
40 std::replace(abc_name.begin(), abc_name.end(),
'.',
'_');
41 std::replace(abc_name.begin(), abc_name.end(),
':',
'_');
42 std::replace(abc_name.begin(), abc_name.end(),
'/',
'_');
50 for (
int i = 0; i < 4; i++) {
51 for (
int j = 0; j < 4; j++) {
52 m[i][j] = double(mat[i][j]);
61 for (
int i = 0; i < 4; i++) {
62 for (
int j = 0; j < 4; j++) {
63 r_mat[i][j] =
float(xform[i][j]);
68void split(
const std::string &s,
const char delim, std::vector<std::string> &tokens)
72 std::stringstream ss(s);
75 while (std::getline(ss, item, delim)) {
77 tokens.push_back(item);
82bool has_property(
const Alembic::Abc::ICompoundProperty &prop,
const std::string &name)
88 return prop.getPropertyHeader(name) !=
nullptr;
92 const Alembic::AbcGeom::ISampleSelector &selector,
93 const std::string &name)
95 for (
size_t i = 0; i < schema.getNumProperties(); i++) {
96 const PropertyHeader &header = schema.getPropertyHeader(i);
98 if (header.isCompound()) {
99 const Alembic::Abc::ICompoundProperty &prop = Alembic::Abc::ICompoundProperty(
100 schema, header.getName());
105 const PropertyHeader *header = prop.getPropertyHeader(name);
106 if (!IV3fArrayProperty::matches(*header)) {
110 const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(prop, name, 0);
112 return velocity_prop.getValue(selector);
116 else if (header.isArray()) {
117 if (header.getName() == name && IV3fArrayProperty::matches(header)) {
118 const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(schema, name, 0);
119 return velocity_prop.getValue(selector);
124 return V3fArraySamplePtr();
127using index_time_pair_t = std::pair<Alembic::AbcCoreAbstract::index_t, Alembic::AbcGeom::chrono_t>;
130 const Alembic::AbcGeom::ISampleSelector &selector,
131 const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling,
132 size_t samples_number)
134 const chrono_t time = selector.getRequestedTime();
135 samples_number = std::max(samples_number,
size_t(1));
138 Alembic::AbcCoreAbstract::index_t i0 = t0.first;
140 if (samples_number == 1 || (
fabs(time - t0.second) < 0.0001)) {
145 Alembic::AbcCoreAbstract::index_t i1 = t1.first;
151 const double bias = (time - t0.second) / (t1.second - t0.second);
153 if (
fabs(1.0 - bias) < 0.0001) {
166 const Alembic::AbcGeom::MetaData &md = args.
object.getMetaData();
168 if (Alembic::AbcGeom::IXform::matches(md)) {
171 else if (Alembic::AbcGeom::IPolyMesh::matches(md)) {
174 else if (Alembic::AbcGeom::ISubD::matches(md)) {
177 else if (Alembic::AbcGeom::INuPatch::matches(md)) {
188 else if (Alembic::AbcGeom::ICamera::matches(md)) {
191 else if (Alembic::AbcGeom::IPoints::matches(md)) {
194 else if (Alembic::AbcMaterial::IMaterial::matches(md)) {
197 else if (Alembic::AbcGeom::ILight::matches(md)) {
200 else if (Alembic::AbcGeom::IFaceSet::matches(md)) {
203 else if (Alembic::AbcGeom::ICurves::matches(md)) {
207 std::cerr <<
"Alembic: unknown how to handle objects of schema '" << md.get(
"schemaObjTitle")
208 <<
"', skipping object '" << args.
object.getFullName() <<
"'" << std::endl;
AbcCameraReader(const AbcReaderConstructorArgs &args)
AbcCurveReader(const AbcReaderConstructorArgs &args)
AbcEmptyReader(const AbcReaderConstructorArgs &args)
AbcMeshReader(const AbcReaderConstructorArgs &args)
AbcNurbsReader(const AbcReaderConstructorArgs &args)
AbcPointsReader(const AbcReaderConstructorArgs &args)
AbcSubDReader(const AbcReaderConstructorArgs &args)
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
std::string get_valid_abc_name(const char *name)
V3fArraySamplePtr get_velocity_prop(const Alembic::Abc::ICompoundProperty &schema, const Alembic::AbcGeom::ISampleSelector &selector, const std::string &name)
AbcObjectReader * create_reader(const AbcReaderConstructorArgs &args)
bool is_reserved_attribute_name(const StringRefNull name)
Imath::M44d convert_matrix_datatype(const float mat[4][4])
std::pair< Alembic::AbcCoreAbstract::index_t, Alembic::AbcGeom::chrono_t > index_time_pair_t
bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name)
std::optional< SampleInterpolationSettings > get_sample_interpolation_settings(const Alembic::AbcGeom::ISampleSelector &selector, const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, size_t samples_number)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const Alembic::Abc::IObject & object