| 353 | } // namespace |
| 354 | |
| 355 | void Primitive::load( IECore::Object::LoadContextPtr context ) |
| 356 | { |
| 357 | unsigned int v = m_ioVersion; |
| 358 | ConstIndexedIOPtr container = context->container( staticTypeName(), v ); |
| 359 | |
| 360 | // we changed the inheritance hierarchy at io version 1 |
| 361 | if( v==0 ) |
| 362 | { |
| 363 | Renderable::load( context ); |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | VisibleRenderable::load( context ); |
| 368 | } |
| 369 | |
| 370 | ConstIndexedIOPtr ioVariables = container->subdirectory( g_variablesEntry ); |
| 371 | |
| 372 | const Canceller *canceller = context->canceller(); |
| 373 | |
| 374 | variables.clear(); |
| 375 | IndexedIO::EntryIDList names; |
| 376 | ioVariables->entryIds( names, IndexedIO::Directory ); |
| 377 | IndexedIO::EntryIDList::const_iterator it; |
| 378 | for( it=names.begin(); it!=names.end(); it++ ) |
| 379 | { |
| 380 | ConstIndexedIOPtr ioPrimVar = ioVariables->subdirectory( *it ); |
| 381 | int i; |
| 382 | ioPrimVar->read( g_interpolationEntry, i ); |
| 383 | |
| 384 | Canceller::check( canceller ); |
| 385 | IntVectorDataPtr indices = nullptr; |
| 386 | if( ioPrimVar->hasEntry( g_indicesEntry ) ) |
| 387 | { |
| 388 | indices = context->load<IntVectorData>( ioPrimVar.get(), g_indicesEntry ); |
| 389 | } |
| 390 | |
| 391 | Canceller::check( canceller ); |
| 392 | variables.insert( |
| 393 | PrimitiveVariableMap::value_type( *it, PrimitiveVariable( (PrimitiveVariable::Interpolation)i, context->load<Data>( ioPrimVar.get(), g_dataEntry ), indices ) ) |
| 394 | ); |
| 395 | } |
| 396 | |
| 397 | if( v < 2 ) |
| 398 | { |
| 399 | ::convertLegacyVariables( variables ); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | PrimitiveVariableMap Primitive::loadPrimitiveVariables( const IndexedIO *ioInterface, const IndexedIO::EntryID &name, const IndexedIO::EntryIDList &primVarNames, const Canceller *canceller ) |
| 404 | { |
nothing calls this directly
no test coverage detected