| 261 | } |
| 262 | |
| 263 | void SceneCacheData::loadSceneIntoCache( ConstSceneInterfacePtr scene ) |
| 264 | { |
| 265 | SceneInterface::Path scenePath; |
| 266 | scene->path( scenePath ); |
| 267 | |
| 268 | // insert internal root into path |
| 269 | auto currentPath = SceneCacheDataAlgo::toInternalPath( scenePath ); |
| 270 | |
| 271 | // store translation to internal path |
| 272 | m_internalPaths[currentPath] = scenePath; |
| 273 | |
| 274 | SdfPath primPath = USDScene::toUSD(currentPath); |
| 275 | |
| 276 | // reset the collection map for each internal root child |
| 277 | if( primPath.GetPathElementCount() == 2 ) |
| 278 | { |
| 279 | m_collections.clear(); |
| 280 | } |
| 281 | |
| 282 | TfTokenVector children; |
| 283 | SpecData spec; |
| 284 | |
| 285 | // load link as reference |
| 286 | if( scene->hasAttribute( LinkedScene::fileNameLinkAttribute ) ) |
| 287 | { |
| 288 | addReference( scene, spec, children ); |
| 289 | } |
| 290 | else |
| 291 | { |
| 292 | // children |
| 293 | SceneInterface::NameList childNames; |
| 294 | scene->childNames( childNames ); |
| 295 | |
| 296 | for ( auto& child: childNames ) |
| 297 | { |
| 298 | children.push_back( TfToken( SceneCacheDataAlgo::toInternalName( child ) ) ); |
| 299 | |
| 300 | // recurse |
| 301 | ConstSceneInterfacePtr childScene = scene->child( child ); |
| 302 | loadSceneIntoCache( childScene ); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | if ( currentPath == SceneInterface::rootPath ) |
| 307 | { |
| 308 | spec.specType = SdfSpecTypePseudoRoot; |
| 309 | |
| 310 | // default prim |
| 311 | spec.fields.push_back( FieldValuePair( SdfFieldKeys->DefaultPrim, SceneCacheDataAlgo::internalRootNameToken() ) ); |
| 312 | |
| 313 | // frame per second |
| 314 | spec.fields.push_back( FieldValuePair( SdfFieldKeys->TimeCodesPerSecond, m_fps ) ); |
| 315 | |
| 316 | // figure out start and end frame based on timeSamples in header |
| 317 | float minTime = std::numeric_limits<float>::max(); |
| 318 | float maxTime = 0; |
| 319 | bool validTimeSampleRange = false; |
| 320 | if ( auto sampleTimesDir = m_sceneio->subdirectory( g_sampleTimes, IndexedIO::MissingBehaviour::NullIfMissing ) ) |
nothing calls this directly
no test coverage detected