Skip to content

Commit ddd1038

Browse files
committed
SceneCacheFileFormatTest: Test support for root location tags.
1 parent 35a1149 commit ddd1038

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

contrib/IECoreUSD/test/IECoreUSD/SceneCacheFileFormatTest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def testTagsLoadedAsCollections( self ):
320320
# includes
321321
fileName = os.path.join( self.temporaryDirectory(), "testUSDTags.scc" )
322322
m = IECoreScene.SceneCache( fileName, IECore.IndexedIO.OpenMode.Write )
323+
m.writeTags( ["geoId:chessy"] )
323324
t = m.createChild( "t" )
324325
s = t.createChild( "s" )
325326
t.writeTags( ["t1", "all", "asset-(12)"] )
@@ -330,6 +331,16 @@ def testTagsLoadedAsCollections( self ):
330331
stage = pxr.Usd.Stage.Open( fileName )
331332
root = stage.GetPseudoRoot()
332333

334+
tagInternalRootPrim = root.GetPrimAtPath( f"/{IECoreUSD.SceneCacheDataAlgo.internalRootName()}" )
335+
self.assertEqual(
336+
tagInternalRootPrim.GetRelationship(
337+
"collection:{}:includes".format(
338+
IECoreUSD.SceneCacheDataAlgo.toInternalName( "geoId:chessy" )
339+
)
340+
).GetTargets(),
341+
[ pxr.Sdf.Path( f"/{IECoreUSD.SceneCacheDataAlgo.internalRootName()}" ) ]
342+
)
343+
333344
tagPrim = root.GetPrimAtPath( "/{}/t".format( IECoreUSD.SceneCacheDataAlgo.internalRootName() ) )
334345
self.assertTrue( tagPrim )
335346

@@ -346,6 +357,10 @@ def testTagsLoadedAsCollections( self ):
346357
stage.Export( exportPath )
347358

348359
scene = IECoreScene.SharedSceneInterfaces.get( exportPath )
360+
# check root tags
361+
self.assertTrue( "geoId:chessy" in scene.readTags() )
362+
363+
# check children tags
349364
for tag, paths in tags.items():
350365
for path in paths:
351366
child = scene.scene( IECoreScene.SceneInterface.stringToPath( path ) )

0 commit comments

Comments
 (0)