MCPcopy Create free account
hub / github.com/ImageEngine/cortex / loadAttributes

Method loadAttributes

contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp:578–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578void 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

Callers

nothing calls this directly

Calls 9

findFunction · 0.85
createFunction · 0.85
subdirectoryMethod · 0.80
hasEntryMethod · 0.80
directoryMethod · 0.45
entryIdsMethod · 0.45
valueMethod · 0.45
readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected