Пример #1
0
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 UpdateDataType( const Alembic::AbcCoreAbstract::PropertyHeader& in_AbcHeader, SAbcDataType& out_AbcFrameworkDataType )
{
	Alembic::Abc::AbcA::DataType in_AbcADataType = in_AbcHeader.getDataType();
	out_AbcFrameworkDataType.m_eType = (EAbcPodType)in_AbcADataType.getPod();
	out_AbcFrameworkDataType.m_numBytes = in_AbcADataType.getPod() == kUnknownPOD ? 0 : in_AbcADataType.getNumBytes();
	out_AbcFrameworkDataType.m_ucExtent = in_AbcADataType.getExtent();
	out_AbcFrameworkDataType.m_eTraits = GetDataTraits( in_AbcHeader );
}
Пример #3
0
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);
        }
    }
}