| 576 | } |
| 577 | |
| 578 | void SceneCacheData::loadAttributes( const SceneInterface::Path& currentPath, TfTokenVector& properties, TfToken& PrimTypeName ) |
| 579 | { |
| 580 | SdfPath primPath = USDScene::toUSD(currentPath); |
| 581 | |
| 582 | // variables |
| 583 | SceneInterface::Path attributesPath; |
| 584 | attributesPath.push_back( g_ioRoot ); |
| 585 | for ( auto& p : currentPath ) |
| 586 | { |
| 587 | // avoid injecting the internal root because |
| 588 | // the path would be invalid in the IndexedIO hierarchy |
| 589 | if ( p == SceneCacheDataAlgo::internalRootName() ) |
| 590 | { |
| 591 | continue; |
| 592 | } |
| 593 | attributesPath.push_back( g_ioChildren ); |
| 594 | attributesPath.push_back( SceneCacheDataAlgo::fromInternalName( p ) ); |
| 595 | } |
| 596 | |
| 597 | attributesPath.push_back( g_ioAttributes ); |
| 598 | |
| 599 | if ( auto attributes = m_sceneio->directory( attributesPath, IndexedIO::MissingBehaviour::NullIfMissing ) ) |
| 600 | { |
| 601 | IndexedIO::EntryIDList attributeLists; |
| 602 | attributes->entryIds( attributeLists ); |
| 603 | for( auto& attr: attributeLists ) |
| 604 | { |
| 605 | |
| 606 | // ignore all private sceneInterface:* |
| 607 | if ( boost::starts_with( attr.string(), g_sceneInterfacePrefix ) ) |
| 608 | { |
| 609 | continue; |
| 610 | } |
| 611 | |
| 612 | auto it = find( g_defaultAttributes.cbegin(), g_defaultAttributes.cend(), attr.value() ); |
| 613 | if( it != g_defaultAttributes.cend() ) |
| 614 | { |
| 615 | continue; |
| 616 | } |
| 617 | |
| 618 | auto attributeIO = attributes->subdirectory( attr, IndexedIO::MissingBehaviour::NullIfMissing ); |
| 619 | |
| 620 | auto timeSamplesIO = attributeIO->subdirectory( g_firstTimeSample, IndexedIO::MissingBehaviour::NullIfMissing ); |
| 621 | if ( !timeSamplesIO ) |
| 622 | { |
| 623 | IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", boost::format( "Unable to find time samples for attribute \"%s\" at location \"%s\"." ) % attr % primPath ); |
| 624 | continue; |
| 625 | } |
| 626 | |
| 627 | // data type |
| 628 | std::string dataTypeValue; |
| 629 | if( !timeSamplesIO->hasEntry( g_ioType ) ) |
| 630 | { |
| 631 | IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", boost::format( "Unable to find data type directory for attribute \"%s\" at location \"%s\"." ) % attr % primPath ); |
| 632 | continue; |
| 633 | } |
| 634 | timeSamplesIO->read( g_ioType, dataTypeValue ); |
| 635 | |