Esempio n. 1
0
GT_PrimitiveHandle GusdPrimWrapper::
defineForRead( const GusdUSD_StageProxyHandle&  stage, 
               const UsdGeomImageable&          sourcePrim, 
               const UsdTimeCode&               time,
               const GusdPurposeSet&            purposes )
{
    GT_PrimitiveHandle gtUsdPrimHandle;

    GusdUSD_ImageableHolder::ScopedLock lock;

    GusdUSD_ImageableHolder holder( sourcePrim, stage->GetLock() );
    lock.Acquire( holder, /*write*/false);

    UsdGeomImageable sourceImageable = *lock;

    // Find the function registered for the source prim's type
    // to define the prim from read and call that function.
    if(sourcePrim) {
        USDTypeToDefineFuncMap::const_iterator mapIt
            = s_usdTypeToFuncMap.find(sourceImageable.GetPrim().GetTypeName());
        if(mapIt != s_usdTypeToFuncMap.end()) {
            gtUsdPrimHandle = mapIt->second(stage,sourcePrim,time,purposes);
        }
    }
    return gtUsdPrimHandle;
}
Esempio n. 2
0
const UsdGeomImageable 
GusdScopeWrapper::getUsdPrimForRead( GusdUSD_ImageableHolder::ScopedLock &lock) const
{
    // obtain first lock to get geomtry as UsdGeomScope.
    GusdUSD_ScopeHolder::ScopedReadLock innerLock;
    innerLock.Acquire( m_usdScopeForRead );

    // Build new holder after casting to imageable
    GusdUSD_ImageableHolder tmp( UsdGeomImageable( (*innerLock).GetPrim() ),
                                 m_usdScopeForRead.GetLock() );
    lock.Acquire(tmp, /*write*/false);
    return *lock;
}