Example #1
0
//-*****************************************************************************
void OCompoundProperty::init( AbcA::CompoundPropertyWriterPtr iParent,
                              const std::string &iName,
                              const Argument &iArg0,
                              const Argument &iArg1,
                              const Argument &iArg2 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "OCompoundProperty::init()" );

    ABCA_ASSERT( iParent, "invalid parent" );

    Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );
    iArg2.setInto( args );

    getErrorHandler().setPolicy( args.getErrorHandlerPolicy() );

    m_property = Alembic::Util::dynamic_pointer_cast<
        AbcA::CompoundPropertyWriter>( iParent->getProperty( iName ) );
    if ( !m_property )
    {
        m_property = iParent->createCompoundProperty( iName,
                                                      args.getMetaData() );
    }

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
//-*****************************************************************************
void OLightSchema::init( AbcA::CompoundPropertyWriterPtr iParent,
                         const Abc::Argument &iArg0,
                         const Abc::Argument &iArg1,
                         const Abc::Argument &iArg2,
                         const Abc::Argument &iArg3 )
{

    AbcA::TimeSamplingPtr tsPtr = Abc::GetTimeSampling( iArg0, iArg1,
                                                        iArg2, iArg3 );

    uint32_t tsIndex = Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2, iArg3 );

    // if we specified a valid TimeSamplingPtr, use it to determine the index
    // otherwise we'll use the index, which defaults to the intrinsic 0 index
    if (tsPtr)
    {
        tsIndex = iParent->getObject()->getArchive()->addTimeSampling( *tsPtr );
        m_tsPtr = tsPtr;
    }
    else
    {
        m_tsPtr = iParent->getObject()->getArchive()->getTimeSampling(
            tsIndex );
    }
}
Example #3
0
//-*****************************************************************************
AbcA::ArrayPropertyWriterPtr
CpwData::createArrayProperty( AbcA::CompoundPropertyWriterPtr iParent,
                              const std::string & iName,
                              const AbcA::MetaData & iMetaData,
                              const AbcA::DataType & iDataType,
                              Util::uint32_t iTimeSamplingIndex )
{
    if ( m_madeProperties.count( iName ) )
    {
        ABCA_THROW( "Already have a property named: " << iName );
    }

    ABCA_ASSERT( iDataType.getExtent() != 0 &&
                 iDataType.getPod() != Alembic::Util::kNumPlainOldDataTypes &&
                 iDataType.getPod() != Alembic::Util::kUnknownPOD,
                 "createArrayProperty, illegal DataType provided.");

    // will assert if TimeSamplingPtr not found
    AbcA::TimeSamplingPtr ts =
        iParent->getObject()->getArchive()->getTimeSampling(
            iTimeSamplingIndex );

    PropertyHeaderPtr headerPtr( new PropertyHeaderAndFriends( iName,
        AbcA::kArrayProperty, iMetaData, iDataType, ts, iTimeSamplingIndex ) );

    Alembic::Util::shared_ptr<ApwImpl>
        ret( new ApwImpl( iParent, m_group->addGroup(), headerPtr,
                          m_propertyHeaders.size() ) );

    m_propertyHeaders.push_back( headerPtr );
    m_madeProperties[iName] = WeakBpwPtr( ret );

    m_hashes.push_back(0);
    m_hashes.push_back(0);

    return ret;
}