bool isColorSet(const Alembic::AbcCoreAbstract::PropertyHeader & iHeader, bool iUnmarkedFaceVaryingColors) { return (Alembic::AbcGeom::IC3fGeomParam::matches(iHeader) || Alembic::AbcGeom::IC4fGeomParam::matches(iHeader)) && Alembic::AbcGeom::GetGeometryScope(iHeader.getMetaData()) == Alembic::AbcGeom::kFacevaryingScope && (iUnmarkedFaceVaryingColors || iHeader.getMetaData().get("mayaColorSet") != ""); }
void copyProps(Alembic::Abc::ICompoundProperty & iRead, Alembic::Abc::OCompoundProperty & iWrite) { std::size_t numChildren = iRead.getNumProperties(); for (std::size_t i = 0; i < numChildren; ++i) { Alembic::AbcCoreAbstract::PropertyHeader header = iRead.getPropertyHeader(i); if (header.isArray()) { Alembic::Abc::IArrayProperty inProp(iRead, header.getName()); Alembic::Abc::OArrayProperty outProp(iWrite, header.getName(), header.getDataType(), header.getMetaData(), header.getTimeSampling()); std::size_t numSamples = inProp.getNumSamples(); for (std::size_t j = 0; j < numSamples; ++j) { Alembic::AbcCoreAbstract::ArraySamplePtr samp; Alembic::Abc::ISampleSelector sel( (Alembic::Abc::index_t) j); inProp.get(samp, sel); outProp.set(*samp); } } else if (header.isScalar()) { Alembic::Abc::IScalarProperty inProp(iRead, header.getName()); Alembic::Abc::OScalarProperty outProp(iWrite, header.getName(), header.getDataType(), header.getMetaData(), header.getTimeSampling()); std::size_t numSamples = inProp.getNumSamples(); std::vector<std::string> sampStrVec; std::vector<std::wstring> sampWStrVec; if (header.getDataType().getPod() == Alembic::AbcCoreAbstract::kStringPOD) { sampStrVec.resize(header.getDataType().getExtent()); } else if (header.getDataType().getPod() == Alembic::AbcCoreAbstract::kWstringPOD) { sampWStrVec.resize(header.getDataType().getExtent()); } char samp[4096]; for (std::size_t j = 0; j < numSamples; ++j) { Alembic::Abc::ISampleSelector sel( (Alembic::Abc::index_t) j); if (header.getDataType().getPod() == Alembic::AbcCoreAbstract::kStringPOD) { inProp.get(&sampStrVec.front(), sel); outProp.set(&sampStrVec.front()); } else if (header.getDataType().getPod() == Alembic::AbcCoreAbstract::kWstringPOD) { inProp.get(&sampWStrVec.front(), sel); outProp.set(&sampWStrVec.front()); } else { inProp.get(samp, sel); outProp.set(samp); } } } else if (header.isCompound()) { Alembic::Abc::OCompoundProperty outProp(iWrite, header.getName(), header.getMetaData()); Alembic::Abc::ICompoundProperty inProp(iRead, header.getName()); copyProps(inProp, outProp); } } }