Skip to content

Commit

Permalink
squash me : test identical shader names
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed May 13, 2024
1 parent 4adea37 commit b921d97
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion python/GafferSceneUITest/ParameterInspectorTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,50 @@ def testTwoConnectionsToSameNode( self ) :
edit = s["add"]["parameters"]["b"]
)

def testIdenticalShaderNames( self ) :

s = Gaffer.ScriptNode()

s["box"] = Gaffer.Box()

s["box"]["add"] = GafferScene.Shader()
s["box"]["add"]["parameters"]["a"] = Gaffer.Color3fPlug()
s["box"]["add"]["out"] = Gaffer.Color3fPlug( direction = Gaffer.Plug.Direction.Out )

s["box"]["outColor"] = Gaffer.BoxOut()
s["box"]["outColor"].setup( s["box"]["add"]["out"] )
s["box"]["outColor"]["in"].setInput( s["box"]["add"]["out"] )

s["add"] = GafferScene.Shader()
s["add"]["parameters"]["a"] = Gaffer.FloatPlug()
s["add"]["out"] = Gaffer.FloatPlug( direction = Gaffer.Plug.Direction.Out )

s["light"] = GafferSceneTest.TestLight()
s["light"]["parameters"]["intensity"].setInput( s["box"]["out"] )
s["light"]["parameters"]["exposure"].setInput( s["add"]["out"] )

self.assertEqual( s["box"]["add"].getName(), s["add"].getName() )

# `intensity` comes first in the parameter list and will be added to the network first
self.__assertExpectedResult(
self.__inspect( s["light"]["out"], "/light", "a", shader = "add" ),
source = s["box"]["add"]["parameters"]["a"],
sourceType = GafferSceneUI.Private.Inspector.Result.SourceType.Other,
editable = True,
edit = s["box"]["add"]["parameters"]["a"]
)

self.__assertExpectedResult(
self.__inspect( s["light"]["out"], "/light", "a", shader = "add1" ),
source = s["add"]["parameters"]["a"],
sourceType = GafferSceneUI.Private.Inspector.Result.SourceType.Other,
editable = True,
edit = s["add"]["parameters"]["a"]
)

# \todo :
# - Test component connections
# - Test splines
# - Test identical node names, one is in a box so the node names don't get de-duped
# - Test disabled node passthrough
# - Detect cycles

Expand Down

0 comments on commit b921d97

Please sign in to comment.