| 208 | } |
| 209 | |
| 210 | void UsdSceneCacheFileFormat::writeLocation( |
| 211 | const SdfLayer& layer, |
| 212 | ConstSceneInterfacePtr inScene, |
| 213 | const InternedString & childName, |
| 214 | SceneInterfacePtr outScene, |
| 215 | double fps, |
| 216 | UsdStageRefPtr stage, |
| 217 | std::set<double> frames |
| 218 | ) const |
| 219 | { |
| 220 | ConstSceneInterfacePtr inChild = inScene->child( childName, SceneInterface::MissingBehaviour::ThrowIfMissing ); |
| 221 | SceneInterfacePtr outChild = outScene; |
| 222 | |
| 223 | if ( childName != SceneCacheDataAlgo::internalRootName() ) |
| 224 | { |
| 225 | outChild = outScene->child( SceneCacheDataAlgo::fromInternalName( childName ), SceneInterface::MissingBehaviour::CreateIfMissing ); |
| 226 | |
| 227 | // static write a single sample. |
| 228 | if( frames.empty() ) |
| 229 | { |
| 230 | frames.insert( 0. ); |
| 231 | } |
| 232 | |
| 233 | //transform |
| 234 | for ( auto& frame : frames ) |
| 235 | { |
| 236 | try |
| 237 | { |
| 238 | outChild->writeTransform( inChild->readTransform( frame / fps ).get(), frame / fps ); |
| 239 | } |
| 240 | catch( ... ) |
| 241 | { |
| 242 | } |
| 243 | } |
| 244 | // location path |
| 245 | SceneInterface::Path currentPath; |
| 246 | inChild->path( currentPath ); |
| 247 | SdfPath primPath = USDScene::toUSD(currentPath); |
| 248 | |
| 249 | if( !primPath.IsAbsoluteRootPath() ) |
| 250 | { |
| 251 | if( const auto linkedOutScene = runTimeCast<LinkedScene>( outChild.get() ) ) |
| 252 | { |
| 253 | const auto& root = layer.GetPseudoRoot(); |
| 254 | const auto& primSpec = root->GetPrimAtPath( primPath ); |
| 255 | |
| 256 | const auto& referenceListOp = primSpec->GetReferenceList(); |
| 257 | std::vector<SdfReference> references; |
| 258 | referenceListOp.ApplyEditsToList( &references ); |
| 259 | |
| 260 | if ( references.size() > 1 ) |
| 261 | { |
| 262 | IECore::msg( |
| 263 | IECore::Msg::Warning, |
| 264 | "SceneCacheFileFormat::writeLocation", |
| 265 | boost::format( "Unsupported multiple reference at location \"%s\", writing only the first reference." ) % primPath |
| 266 | ); |
| 267 | } |
nothing calls this directly
no test coverage detected