#NEWLINE# def test( self ) : #NEWLINE# #INDENT# sphere = IECore . SpherePrimitive ( ) #NEWLINE# instanceInput = GafferSceneTest . CompoundObjectSource ( ) #NEWLINE# instanceInput [ 'in' ] . setValue ( IECore . CompoundObject ( { #NEWLINE# #INDENT# 'bound' : IECore . Box3fData ( IECore . Box3f ( IECore . V3f ( ( - 2 ) ) , IECore . V3f ( 2 ) ) ) , #NEWLINE# 'children' : { #NEWLINE# #INDENT# 'sphere' : { #NEWLINE# #INDENT# 'object' : sphere , #NEWLINE# 'bound' : IECore . Box3fData ( sphere . bound ( ) ) , #NEWLINE# 'transform' : IECore . M44fData ( IECore . M44f . createScaled ( IECore . V3f ( 2 ) ) ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# seeds = IECore . PointsPrimitive ( IECore . V3fVectorData ( [ IECore . V3f ( 1 , 0 , 0 ) , IECore . V3f ( 1 , 1 , 0 ) , IECore . V3f ( 0 , 1 , 0 ) , IECore . V3f ( 0 , 0 , 0 ) ] ) ) #NEWLINE# seedsInput = GafferSceneTest . CompoundObjectSource ( ) #NEWLINE# seedsInput [ 'in' ] . setValue ( IECore . CompoundObject ( { #NEWLINE# #INDENT# 'bound' : IECore . Box3fData ( IECore . Box3f ( IECore . V3f ( 1 , 0 , 0 ) , IECore . V3f ( 2 , 1 , 0 ) ) ) , #NEWLINE# 'children' : { #NEWLINE# #INDENT# 'seeds' : { #NEWLINE# #INDENT# 'bound' : IECore . Box3fData ( seeds . bound ( ) ) , #NEWLINE# 'transform' : IECore . M44fData ( IECore . M44f . createTranslated ( IECore . V3f ( 1 , 0 , 0 ) ) ) , #NEWLINE# 'object' : seeds , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# instancer = GafferScene . Instancer ( ) #NEWLINE# instancer [ 'in' ] . setInput ( seedsInput [ 'out' ] ) #NEWLINE# instancer [ 'instance' ] . setInput ( instanceInput [ 'out' ] ) #NEWLINE# instancer [ 'parent' ] . setValue ( '/seeds' ) #NEWLINE# instancer [ 'name' ] . setValue ( 'instances' ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . object ( '/' ) , IECore . NullObject ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . transform ( '/' ) , IECore . M44f ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . bound ( '/' ) , IECore . Box3f ( IECore . V3f ( ( - 1 ) , ( - 2 ) , ( - 2 ) ) , IECore . V3f ( 4 , 3 , 2 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . childNames ( '/' ) , IECore . InternedStringVectorData ( [ 'seeds' ] ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . object ( '/seeds' ) , seeds ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . transform ( '/seeds' ) , IECore . M44f ( ) . createTranslated ( IECore . V3f ( 1 , 0 , 0 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . bound ( '/seeds' ) , IECore . Box3f ( IECore . V3f ( ( - 2 ) , ( - 2 ) , ( - 2 ) ) , IECore . V3f ( 3 , 3 , 2 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . childNames ( '/seeds' ) , IECore . InternedStringVectorData ( [ 'instances' ] ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . object ( '/seeds/instances' ) , IECore . NullObject ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . transform ( '/seeds/instances' ) , IECore . M44f ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . bound ( '/seeds/instances' ) , IECore . Box3f ( IECore . V3f ( ( - 2 ) , ( - 2 ) , ( - 2 ) ) , IECore . V3f ( 3 , 3 , 2 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . childNames ( '/seeds/instances' ) , IECore . InternedStringVectorData ( [ '0' , '1' , '2' , '3' ] ) ) #NEWLINE# for i in range ( 0 , 4 ) : #NEWLINE# #INDENT# instancePath = ( '/seeds/instances/%d' % i ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . object ( instancePath ) , IECore . NullObject ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . transform ( instancePath ) , IECore . M44f . createTranslated ( seeds [ 'P' ] . data [ i ] ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . bound ( instancePath ) , IECore . Box3f ( IECore . V3f ( ( - 2 ) ) , IECore . V3f ( 2 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . childNames ( instancePath ) , IECore . InternedStringVectorData ( [ 'sphere' ] ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . object ( ( instancePath + '/sphere' ) ) , sphere ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . transform ( ( instancePath + '/sphere' ) ) , IECore . M44f . createScaled ( IECore . V3f ( 2 ) ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . bound ( ( instancePath + '/sphere' ) ) , sphere . bound ( ) ) #NEWLINE# self . assertEqual ( instancer [ 'out' ] . childNames ( ( instancePath + '/sphere' ) ) , IECore . InternedStringVectorData ( ) )