@@ -406,7 +406,10 @@ def testSplineConversion( self ):
406406 ( ( 0 , 1 ), ( 0.2 , 6 ), ( 0.3 , 7 ) ) ) )
407407
408408 shaderNetworkOrig = IECoreScene .ShaderNetwork (
409- shaders = { "test" : IECoreScene .Shader ( "test" , "osl:shader" , parms ) },
409+ shaders = {
410+ "test" : IECoreScene .Shader ( "test" , "osl:shader" , parms ),
411+ "riTest" : IECoreScene .Shader ( "PxrTest" , "osl:shader" , parms )
412+ },
410413 output = "test"
411414 )
412415 shaderNetwork = shaderNetworkOrig .copy ()
@@ -429,6 +432,21 @@ def testSplineConversion( self ):
429432 ]:
430433 self .assertEqual ( len ( parms [name ].value .keys () ) + extra , len ( parmsExpanded [name + "Positions" ] ) )
431434
435+ riParmsExpanded = shaderNetwork .getShader ( "riTest" ).parameters
436+
437+ # Test a few things in the PRMan convention, and that we've got the extra "count" plugs
438+ self .assertEqual ( set ( riParmsExpanded .keys () ), set ( [ i + suffix for suffix in [ "" , "_Interpolation" , "_Knots" ] for i in parms .keys () ] + [ 'testffbSpline_Floats' , 'testffbezier_Floats' , 'testfColor3fcatmullRom_Colors' , 'testfColor3flinear_Colors' , 'testffconstant_Floats' ] ) )
439+ self .assertEqual ( riParmsExpanded ["testffbSpline_Interpolation" ], IECore .StringData ( "bspline" ) )
440+ self .assertEqual ( riParmsExpanded ["testffbSpline_Knots" ], IECore .FloatVectorData ( [ 0 , 10 , 20 , 21 ] ) )
441+ self .assertEqual ( riParmsExpanded ["testffbSpline_Floats" ], IECore .FloatVectorData ( [ 1 , 2 , 0 , 2 ] ) )
442+ self .assertEqual ( riParmsExpanded ["testffbSpline" ], IECore .IntData ( 4 ) )
443+ self .assertEqual ( riParmsExpanded ["testfColor3fcatmullRom_Knots" ], IECore .FloatVectorData ( [ 0 , 10 , 20 , 30 , 40 , 50 ] ) )
444+ self .assertEqual ( riParmsExpanded ["testfColor3fcatmullRom_Colors" ], IECore .Color3fVectorData ( [ imath .Color3f ( i ) for i in [ 1 , 2 , 0 , 5 , 2 , 6 ] ] ) )
445+ self .assertEqual ( riParmsExpanded ["testfColor3fcatmullRom" ], IECore .IntData ( 6 ) )
446+ self .assertEqual ( riParmsExpanded ["testfColor3flinear_Colors" ], IECore .Color3fVectorData ( [ imath .Color3f ( i ) for i in [ 1 , 1 , 2 , 0 , 0 ] ] ) )
447+ self .assertEqual ( riParmsExpanded ["testfColor3flinear" ], IECore .IntData ( 5 ) )
448+
449+
432450 IECoreScene .ShaderNetworkAlgo .collapseSplines ( shaderNetwork )
433451
434452 self .assertEqual ( shaderNetwork , shaderNetworkOrig )
@@ -490,6 +508,30 @@ def testSplineConversion( self ):
490508 IECoreScene .ShaderNetworkAlgo .collapseSplines ( shaderNetworkInvalid )
491509 self .assertEqual ( shaderNetworkInvalid , shaderNetworkInvalidOrig )
492510
511+ riParmsExpandedBadCounts = riParmsExpanded .copy ()
512+ del riParmsExpandedBadCounts ["testffbSpline" ]
513+ riParmsExpandedBadCounts ["testffbezier" ] = IECore .IntData ( 10 )
514+
515+ riShaderNetworkBadCounts = IECoreScene .ShaderNetwork (
516+ shaders = { "test" : IECoreScene .Shader ( "PxrTest" , "osl:shader" , riParmsExpandedBadCounts ) },
517+ output = "test"
518+ )
519+ messageHandler = IECore .CapturingMessageHandler ()
520+ with messageHandler :
521+ IECoreScene .ShaderNetworkAlgo .collapseSplines ( riShaderNetworkBadCounts )
522+
523+ self .assertEqual (
524+ set ( [ i .message for i in messageHandler .messages ] ),
525+ set ( [
526+ 'Using spline format that expects count parameter, but no int count parameter found matching "testffbSpline"' ,
527+ 'Spline count "testffbezier" does not match length of data: 10 != 5"'
528+ ] )
529+ )
530+
531+ # IF we re-expand things, the counts have just been recomputed, and everything is back the way it was before
532+ IECoreScene .ShaderNetworkAlgo .expandSplines ( riShaderNetworkBadCounts )
533+ self .assertEqual ( riShaderNetworkBadCounts .getShader ( "test" ).parameters , riParmsExpanded )
534+
493535 def testSplineInputs ( self ):
494536
495537 fC3fcatmullRom = IECore .SplinefColor3fData ( IECore .SplinefColor3f (
0 commit comments