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

Method writeLocation

contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp:210–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void 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 }

Callers

nothing calls this directly

Calls 15

fromInternalPathFunction · 0.85
insertMethod · 0.80
writeLinkMethod · 0.80
getFunction · 0.50
childMethod · 0.45
writeTransformMethod · 0.45
getMethod · 0.45
readTransformMethod · 0.45
pathMethod · 0.45
sizeMethod · 0.45
sceneMethod · 0.45
writeAttributeMethod · 0.45

Tested by

no test coverage detected