Skip to content

Commit

Permalink
Merge pull request #1378 from ivanimanishi/linkLocationsFix
Browse files Browse the repository at this point in the history
LinkedScene : Fix incorrect `linkLocations` attribute value
  • Loading branch information
ivanimanishi authored Jul 21, 2023
2 parents 43d779d + c7538a7 commit 45a3975
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
10.4.x.x (relative to 10.4.10.1)
========

Fixes
-----

- LinkedScene : Fixed bug where `linkLocations` attribute was baked incorrectly if the link target location wasn't the ROOT
- This in turn caused LinkedScene::setNames() and LinkedScene::readSet() to error

10.4.10.1 (relative to 10.4.10.0)
========

Expand Down
1 change: 1 addition & 0 deletions src/IECoreScene/LinkedScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ void LinkedScene::writeAttribute( const Name &name, const Object *attribute, dou
{
throw Exception( "Trying to store a broken link!" );
}
m_rootLinkDepth = linkDepth;

// check for child name clashes:
NameList mainSceneChildren;
Expand Down
21 changes: 18 additions & 3 deletions test/IECoreScene/LinkedSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,26 +1094,41 @@ def testCanReadSetNamesAndMembersOfLinkedScene( self ) :

r = IECoreScene.SceneCache( sceneFile, IECore.IndexedIO.OpenMode.Read )
A = r.child( "A" )
B = A.child( "B" )

# Master scene which contains link to above scene
# C
# D -> [target.scc, /]
# E
# A -> [target.scc, /A]
# F
# A
# B -> [target.scc, /A/B]

sceneFile = os.path.join( self.tempDir, "scene.lscc" )
w = IECoreScene.LinkedScene( sceneFile, IECore.IndexedIO.OpenMode.Write )
C = w.createChild( "C" )
D = C.createChild( "D" )

E = w.createChild( "E" )
A1 = E.createChild( "A" )

F = w.createChild( "F" )
A2 = F.createChild( "A" )
B1 = A2.createChild( "B" )

A1.writeLink( A )
D.writeLink( r )
B1.writeLink( B )

del w, C, D
del w, C, D, E, F, A1, A2, B1

# ok lets read back in our linked scene and try and read the set names
r = IECoreScene.LinkedScene( sceneFile, IECore.IndexedIO.OpenMode.Read )
self.assertEqualUnordered( r.setNames(), ['don', 'stew'] )

self.assertEqual( r.readSet( "don" ), IECore.PathMatcher(['/C/D/A'] ) )
self.assertEqual( r.readSet( "stew" ), IECore.PathMatcher(['/C/D/A/B'] ) )
self.assertEqual( r.readSet( "don" ), IECore.PathMatcher( ['/C/D/A', '/E/A' ] ) )
self.assertEqual( r.readSet( "stew" ), IECore.PathMatcher( ['/C/D/A/B', '/E/A/B', '/F/A/B' ] ) )

self.assertEqualUnordered( r.setNames( includeDescendantSets = False ), [] )

Expand Down

0 comments on commit 45a3975

Please sign in to comment.