Skip to content

Commit

Permalink
EncapsulateTest : Use assertScenesRenderSame as extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Sep 27, 2023
1 parent f91dfe7 commit c10701d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/GafferSceneTest/EncapsulateTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#
##########################################################################

import inspect
import imath
import unittest
import subprocess

Expand All @@ -56,6 +56,7 @@ def test( self ) :

sphere = GafferScene.Sphere()
sphere["sets"].setValue( "sphereSet" )
sphere["transform"]["translate"].setValue( imath.V3f( 1, 2, 3 ) )

cube = GafferScene.Cube()
cube["sets"].setValue( "cubeSet" )
Expand All @@ -64,11 +65,13 @@ def test( self ) :
groupB["in"][0].setInput( sphere["out"] )
groupB["in"][1].setInput( cube["out"] )
groupB["name"].setValue( "groupB" )
groupB["transform"]["rotate"].setValue( imath.V3f( 100, 200, 300 ) )

groupA = GafferScene.Group()
groupA["in"][0].setInput( groupB["out"] )
groupA["in"][1].setInput( sphere["out"] )
groupA["name"].setValue( "groupA" )
groupA["transform"]["rotate"].setValue( imath.V3f( 400, 500, 600 ) )

# When there is no filter attached, the node
# should be an exact pass-through.
Expand Down Expand Up @@ -136,6 +139,10 @@ def test( self ) :
with self.assertRaisesRegex( Gaffer.ProcessException, "Encapsulate.out.object : Tried to access path \"/groupA/groupB/sphere\", but its ancestor has been converted to a capsule" ):
encapsulate["out"].object( "/groupA/groupB/sphere" )

# Check that the capsule expands during rendering to render the same as the unencapsulated scene.
# ( Except for the light links, which aren't output by the Capsule currently )
self.assertScenesRenderSame( encapsulate["in"], encapsulate["out"], expandProcedurals = True, ignoreLinks = True )

# As a double check, test that this setup works properly with Unencapsulate
unencapsulateFilter = GafferScene.PathFilter()

Expand Down

0 comments on commit c10701d

Please sign in to comment.