예제 #1
0
//-*****************************************************************************
IFaceSet
ISubDSchema::getFaceSet( const std::string &iFaceSetName )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ISubDSchema::getFaceSet()" );
    Alembic::Util::scoped_lock l(m_faceSetsMutex);
    if (!m_faceSetsLoaded)
    {
        loadFaceSetNames();
    }

    ABCA_ASSERT( m_faceSets.find (iFaceSetName) != m_faceSets.end (),
        "The requested FaceSet name can't be found in SubD.");

    if (!m_faceSets [iFaceSetName])
    {
        // We haven't yet loaded the faceSet, so create/load it
        m_faceSets [iFaceSetName] = IFaceSet ( getObject(), iFaceSetName );
    }

    return m_faceSets [iFaceSetName];

    ALEMBIC_ABC_SAFE_CALL_END();

    IFaceSet empty;
    return empty;
}
예제 #2
0
//-*****************************************************************************
void ISubDSchema::loadFaceSetNames()
{
    // Caller must ensure they have locked m_faceSetsMutex.
    // (allows us to use non-recursive mutex)
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ISubDSchema::loadFaceSetNames()" );

    if (!m_faceSetsLoaded)
    {
        // iterate over childHeaders, and if header matches
        // FaceSet add to our vec
        IObject _thisObject = getObject();

        size_t numChildren = _thisObject.getNumChildren();
        for ( size_t childIndex = 0 ; childIndex < numChildren; childIndex++ )
        {
            ObjectHeader const & header = _thisObject.getChildHeader (childIndex);
            if ( IFaceSet::matches( header ) )
            {
                // start out with an empty (invalid IFaceSet)
                // accessor later on will create real IFaceSet object.
                m_faceSets [header.getName ()] = IFaceSet ();
            }
        }
        m_faceSetsLoaded = true;
    }

    ALEMBIC_ABC_SAFE_CALL_END();
}
예제 #3
0
//-*****************************************************************************
IFaceSet
IPolyMeshSchema::getFaceSet ( const std::string &iFaceSetName )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "IPolyMeshSchema::getFaceSet()" );
    boost::mutex::scoped_lock l(m_faceSetsMutex);
    if (!m_faceSetsLoaded)
    {
        loadFaceSetNames();
    }

    ABCA_ASSERT( m_faceSets.find (iFaceSetName) != m_faceSets.end (),
        "The requested FaceSet name can't be found in PolyMesh.");

    if (!m_faceSets [iFaceSetName])
    {
        // We haven't yet loaded the faceSet, so create/load it
        m_faceSets [iFaceSetName] = IFaceSet ( this->getParent().getObject(),
                                               iFaceSetName );
    }

    return m_faceSets [iFaceSetName];

    ALEMBIC_ABC_SAFE_CALL_END();

    IFaceSet emptyFaceSet;
    return emptyFaceSet;
}
예제 #4
0
//-*****************************************************************************
void IPolyMeshSchema::init( const Abc::Argument &iArg0,
                            const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "IPolyMeshSchema::init()" );

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching );

    m_indicesProperty = Abc::IInt32ArrayProperty( _this, ".faceIndices",
                                        args.getSchemaInterpMatching() );
    m_countsProperty = Abc::IInt32ArrayProperty( _this, ".faceCounts",
                                       args.getSchemaInterpMatching() );

    // none of the things below here are guaranteed to exist
    if ( this->getPropertyHeader( "uv" ) != NULL )
    {
        m_uvsParam = IV2fGeomParam( _this, "uv", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "N" ) != NULL )
    {
        m_normalsParam = IN3fGeomParam( _this, "N", iArg0, iArg1 );
    }


    IObject _thisObject = this->getParent().getObject();
    size_t numChildren = _thisObject.getNumChildren();
    for ( size_t childIndex = 0 ; childIndex < numChildren; childIndex++ )
    {
        ObjectHeader const & header = _thisObject.getChildHeader (childIndex);
        if ( IFaceSet::matches( header ) )
        {
            // start out with an empty (invalid IFaceSet)
            // accessor later on will create real IFaceSet object.
            m_faceSets [header.getName ()] = IFaceSet ();
        }
    }

    m_faceSetsLoaded = false;

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}