Skip to content

Commit 5d1bedc

Browse files
Add a basic test for how splines work in SCC currently
1 parent 9792de0 commit 5d1bedc

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

test/IECoreScene/SceneCacheTest.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import shutil
4040
import os
4141
import tempfile
42+
import pathlib
4243

4344
import IECore
4445
import IECoreScene
@@ -1200,6 +1201,40 @@ def testObjectVectorShaderCompatibility( self ) :
12001201
for a in nonShaderAttributes :
12011202
self.assertEqual( c.readAttribute( a, 0 ), objectVector )
12021203

1204+
def testDeprecatedSplines( self ) :
1205+
1206+
fileName = pathlib.Path( __file__ ).parent / "data" / "oldSplines.scc"
1207+
root = IECoreScene.SceneInterface.create( str( fileName ), IECore.IndexedIO.OpenMode.Read )
1208+
child = root.child( "cube" )
1209+
1210+
shaderNetwork = child.readAttribute( "ai:surface", 0 )
1211+
self.assertEqual(
1212+
shaderNetwork.getShader( "ColorSpline" ).parameters["spline"],
1213+
IECore.SplinefColor3fData( IECore.SplinefColor3f(
1214+
IECore.CubicBasisf.linear(),
1215+
(
1216+
( 0, imath.Color3f( 0, 0, 0 ) ),
1217+
( 0.4, imath.Color3f( 0.3, 0.5, 0.9 ) ),
1218+
( 0.7, imath.Color3f( 0.8, 0.7, 0.3) ),
1219+
( 1, imath.Color3f( 1, 1, 1 ) )
1220+
)
1221+
) )
1222+
)
1223+
1224+
self.assertEqual(
1225+
shaderNetwork.getShader( "FloatSpline" ).parameters["spline"],
1226+
IECore.SplineffData(IECore.Splineff(
1227+
IECore.CubicBasisf.bSpline(),
1228+
(
1229+
( 0, 0 ), ( 0, 0 ), ( 0, 0 ),
1230+
( 0.3, 0.8 ),
1231+
( 0.7, 0.7 ),
1232+
( 0.9, 0.1 ),
1233+
( 1, 1 ), ( 1, 1 ), ( 1, 1 )
1234+
)
1235+
) )
1236+
)
1237+
12031238
def testCopyReturnValues( self ):
12041239

12051240
fileName = os.path.join( self.tempDir, "test.scc" )
6.08 KB
Binary file not shown.

0 commit comments

Comments
 (0)