@@ -482,7 +482,7 @@ def testInstancePrototypeHashesNotReused( self ) :
482482 # The solution we've ended up with is instead of assigning consistent hashes, each instance of the
483483 # file gets it's own unique hashes, and is basically treated separately. This allows us to just
484484 # use the prototype names in the hash, since we force the hash to be unique anyway.
485-
485+
486486 usedHashes = set ()
487487
488488 for i in range ( 100 ):
@@ -506,7 +506,7 @@ def testInstancePrototypeHashesNotReused( self ) :
506506 instanceJ = scene .child ( "instance%i" % j )
507507 self .assertEqual ( h1 , instanceJ .child ( "world" ).hash ( scene .HashType .TransformHash , 1 ) )
508508 del instanceJ
509-
509+
510510 self .assertNotIn ( h2 , usedHashes )
511511 for j in range ( 11 , 20 ):
512512 instanceJ = scene .child ( "instance%i" % j )
@@ -2681,7 +2681,8 @@ def testShaders( self ) :
26812681 oneShaderNetwork .addShader ( "foo" , surface )
26822682 oneShaderNetwork .setOutput ( IECoreScene .ShaderNetwork .Parameter ( "foo" , "" ) )
26832683
2684- # A network with no output can be written out, but it will read back in as empty
2684+ # A network with no output can be written out, but not read back in, because
2685+ # it will not have been connected to a material output.
26852686 noOutputNetwork = IECoreScene .ShaderNetwork ()
26862687 noOutputNetwork .addShader ( "foo" , surface )
26872688
@@ -2868,14 +2869,14 @@ def testShaders( self ) :
28682869
28692870 root = IECoreScene .SceneInterface .create ( fileName , IECore .IndexedIO .OpenMode .Read )
28702871
2871- self .assertEqual ( set ( root .child ( "shaderLocation" ).attributeNames () ), set ( ['ai:disp_map' , 'ai:surface' , 'complex:surface' , 'testBad:surface' , ' volume' , 'componentConnection:surface' , 'manualComponent:surface' ] ) )
2872+ self .assertEqual ( set ( root .child ( "shaderLocation" ).attributeNames () ), set ( ['ai:disp_map' , 'ai:surface' , 'complex:surface' , 'volume' , 'componentConnection:surface' , 'manualComponent:surface' ] ) )
28722873
28732874 self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "ai:surface" , 0 ).outputShader ().parameters , oneShaderNetwork .outputShader ().parameters )
28742875 self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "ai:surface" , 0 ).outputShader (), oneShaderNetwork .outputShader () )
28752876 self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "ai:surface" , 0 ), oneShaderNetwork )
2876- self .assertTrue ( root .child ( "shaderLocation" ).hasAttribute ( "testBad:surface" ) )
2877+ self .assertFalse ( root .child ( "shaderLocation" ).hasAttribute ( "testBad:surface" ) )
28772878
2878- self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "testBad:surface" , 0 ), IECoreScene . ShaderNetwork () )
2879+ self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "testBad:surface" , 0 ), None )
28792880 self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "ai:disp_map" , 0 ), pickOutputNetwork )
28802881 self .assertEqual ( root .child ( "shaderLocation" ).hasAttribute ( "ai:volume" ), False )
28812882 self .assertEqual ( root .child ( "shaderLocation" ).readAttribute ( "volume" , 0 ), oneShaderNetwork )
@@ -3667,5 +3668,17 @@ def testMaterialBindingInsideInstance( self ) :
36673668 shader2 = instance2 .readAttribute ( "surface" , 0.0 , _copy = False )
36683669 self .assertTrue ( shader1 .isSame ( shader2 ) )
36693670
3671+ def testUnconnectedMaterialOutput ( self ) :
3672+
3673+ root = IECoreScene .SceneInterface .create (
3674+ os .path .join ( os .path .dirname ( __file__ ), "data" , "unconnectedMaterialOutput.usda" ),
3675+ IECore .IndexedIO .OpenMode .Read
3676+ )
3677+
3678+ sphere = root .child ( "sphere" )
3679+ self .assertFalse ( sphere .hasAttribute ( "cycles:surface" ) )
3680+ self .assertNotIn ( "cycles:surface" , sphere .attributeNames () )
3681+ self .assertIsNone ( sphere .readAttribute ( "cycles:surface" , 0 ) )
3682+
36703683if __name__ == "__main__" :
36713684 unittest .main ()
0 commit comments