Skip to content

Commit 45a3975

Browse files
authored
Merge pull request #1378 from ivanimanishi/linkLocationsFix
LinkedScene : Fix incorrect `linkLocations` attribute value
2 parents 43d779d + c7538a7 commit 45a3975

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

Changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
10.4.x.x (relative to 10.4.10.1)
22
========
33

4+
Fixes
5+
-----
6+
7+
- LinkedScene : Fixed bug where `linkLocations` attribute was baked incorrectly if the link target location wasn't the ROOT
8+
- This in turn caused LinkedScene::setNames() and LinkedScene::readSet() to error
9+
410
10.4.10.1 (relative to 10.4.10.0)
511
========
612

src/IECoreScene/LinkedScene.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ void LinkedScene::writeAttribute( const Name &name, const Object *attribute, dou
700700
{
701701
throw Exception( "Trying to store a broken link!" );
702702
}
703+
m_rootLinkDepth = linkDepth;
703704

704705
// check for child name clashes:
705706
NameList mainSceneChildren;

test/IECoreScene/LinkedSceneTest.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,26 +1094,41 @@ def testCanReadSetNamesAndMembersOfLinkedScene( self ) :
10941094

10951095
r = IECoreScene.SceneCache( sceneFile, IECore.IndexedIO.OpenMode.Read )
10961096
A = r.child( "A" )
1097+
B = A.child( "B" )
10971098

10981099
# Master scene which contains link to above scene
10991100
# C
11001101
# D -> [target.scc, /]
1102+
# E
1103+
# A -> [target.scc, /A]
1104+
# F
1105+
# A
1106+
# B -> [target.scc, /A/B]
11011107

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

1113+
E = w.createChild( "E" )
1114+
A1 = E.createChild( "A" )
1115+
1116+
F = w.createChild( "F" )
1117+
A2 = F.createChild( "A" )
1118+
B1 = A2.createChild( "B" )
1119+
1120+
A1.writeLink( A )
11071121
D.writeLink( r )
1122+
B1.writeLink( B )
11081123

1109-
del w, C, D
1124+
del w, C, D, E, F, A1, A2, B1
11101125

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

1115-
self.assertEqual( r.readSet( "don" ), IECore.PathMatcher(['/C/D/A'] ) )
1116-
self.assertEqual( r.readSet( "stew" ), IECore.PathMatcher(['/C/D/A/B'] ) )
1130+
self.assertEqual( r.readSet( "don" ), IECore.PathMatcher( ['/C/D/A', '/E/A' ] ) )
1131+
self.assertEqual( r.readSet( "stew" ), IECore.PathMatcher( ['/C/D/A/B', '/E/A/B', '/F/A/B' ] ) )
11171132

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

0 commit comments

Comments
 (0)