Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SceneAlgo::history not working on common production setups #3821

Closed
andrewkaufman opened this issue Jul 8, 2020 · 3 comments
Closed

SceneAlgo::history not working on common production setups #3821

andrewkaufman opened this issue Jul 8, 2020 · 3 comments

Comments

@andrewkaufman
Copy link
Contributor

Version: Gaffer 0.57.5.0-linux
Third-party tools: Appleseed
Third-party modules: None

Description

The CropWindowTool in the 2d Viewer is failing to find a plug to drive in the script below. The key issue seems to be that the enabled plug of one of the GlobalsProcessor is driven by an Expression which computes the input globals.

Running a GafferScene.SceneAlgo.history trace (my code is included in a backdrop in the script) shows a dead-end at gui.scripts.ScriptNode1.CustomOptions.out

Note that altering the Expression to not read the incoming globals allows the trace to complete successfully and the CropWindowTool begins working as expected.

Steps to reproduce

  1. Open the script below
  2. Start the InteractiveAppleseedRender
  3. View the Catalogue
  4. Enable the CropwWindowTool
  5. It errors saying "No crop window found. Insert a StandardOptions node."

Debug log

Click to Expand

import Gaffer
import GafferAppleseed
import GafferImage
import GafferScene
import IECore
import imath

Gaffer.Metadata.registerValue( parent, "serialiser:milestoneVersion", 0, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:majorVersion", 57, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:minorVersion", 5, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:patchVersion", 0, persistent=False )

__children = {}

parent["variables"].addChild( Gaffer.NameValuePlug( "image:catalogue:port", Gaffer.IntPlug( "value", defaultValue = 0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "imageCataloguePort", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "project:name", Gaffer.StringPlug( "value", defaultValue = 'default', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "projectName", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "project:rootDirectory", Gaffer.StringPlug( "value", defaultValue = '$HOME/gaffer/projects/${project:name}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "projectRootDirectory", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "workingPath", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "workingPath", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "job", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "job", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "sequence", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "sequence", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "shot", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "shot", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "scene", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "scene", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "jabuka:location", Gaffer.StringPlug( "value", defaultValue = '/SBX/rnd/alpha', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "jabuka_location", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
parent["variables"].addChild( Gaffer.NameValuePlug( "jabuka:lightingReferenceShotLocation", Gaffer.StringPlug( "value", defaultValue = '/SBX/rnd/alpha', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "jabuka_lightingReferenceShotLocation", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["defaultFormat"] = GafferImage.FormatPlug( "defaultFormat", defaultValue = GafferImage.Format( 1920, 1080, 1.000 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, )
parent.addChild( __children["defaultFormat"] )
__children["Sphere"] = GafferScene.Sphere( "Sphere" )
parent.addChild( __children["Sphere"] )
__children["Sphere"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Cube"] = GafferScene.Cube( "Cube" )
parent.addChild( __children["Cube"] )
__children["Cube"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Camera"] = GafferScene.Camera( "Camera" )
parent.addChild( __children["Camera"] )
__children["Camera"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Parent"] = GafferScene.Parent( "Parent" )
parent.addChild( __children["Parent"] )
__children["Parent"]["children"].addChild( GafferScene.ScenePlug( "child1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Parent"]["children"].addChild( GafferScene.ScenePlug( "child2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Parent"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Backdrop"] = Gaffer.Backdrop( "Backdrop" )
parent.addChild( __children["Backdrop"] )
__children["Backdrop"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Backdrop"].addChild( Gaffer.Box2fPlug( "__uiBound", defaultValue = imath.Box2f( imath.V2f( -10, -10 ), imath.V2f( 10, 10 ) ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["StandardOptions"] = GafferScene.StandardOptions( "StandardOptions" )
parent.addChild( __children["StandardOptions"] )
__children["StandardOptions"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"] = GafferScene.Outputs( "Outputs" )
parent.addChild( __children["Outputs"] )
__children["Outputs"]["outputs"].addChild( Gaffer.ValuePlug( "output1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.BoolPlug( "active", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "fileName", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "type", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "data", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"].addChild( Gaffer.CompoundDataPlug( "parameters", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "quantize", Gaffer.IntVectorDataPlug( "value", defaultValue = IECore.IntVectorData( [ 0, 0, 0, 0 ] ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "quantize", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "displayHost", Gaffer.StringPlug( "value", defaultValue = 'localhost', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "displayHost", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "remoteDisplayType", Gaffer.StringPlug( "value", defaultValue = 'GafferImage::GafferDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "remoteDisplayType", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "driverType", Gaffer.StringPlug( "value", defaultValue = 'ClientDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "driverType", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "displayPort", Gaffer.StringPlug( "value", defaultValue = '${image:catalogue:port}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "displayPort", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["Outputs"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["InteractiveAppleseedRender"] = GafferAppleseed.InteractiveAppleseedRender( "InteractiveAppleseedRender" )
parent.addChild( __children["InteractiveAppleseedRender"] )
__children["InteractiveAppleseedRender"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Catalogue"] = GafferImage.Catalogue( "Catalogue" )
parent.addChild( __children["Catalogue"] )
__children["Catalogue"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["CustomOptions"] = GafferScene.CustomOptions( "CustomOptions" )
parent.addChild( __children["CustomOptions"] )
__children["CustomOptions"]["options"].addChild( Gaffer.NameValuePlug( "", Gaffer.BoolPlug( "value", defaultValue = False, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), True, "member1", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
__children["CustomOptions"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Expression"] = Gaffer.Expression( "Expression" )
parent.addChild( __children["Expression"] )
__children["Expression"]["__in"].addChild( Gaffer.CompoundObjectPlug( "p0", defaultValue = IECore.CompoundObject(), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Expression"]["__out"].addChild( Gaffer.BoolPlug( "p0", direction = Gaffer.Plug.Direction.Out, defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Expression"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
parent["frameRange"]["start"].setValue( 1001 )
parent["frameRange"]["end"].setValue( 1100 )
parent["frame"].setValue( 1001.0 )
parent["variables"]["imageCataloguePort"]["value"].setValue( 41646 )
parent["variables"]["workingPath"]["value"].setValue( '/data/jobs/SBX/sequences/rnd/shots/alpha' )
parent["variables"]["job"]["value"].setValue( 'SBX' )
parent["variables"]["sequence"]["value"].setValue( 'rnd' )
parent["variables"]["shot"]["value"].setValue( 'alpha' )
parent["variables"]["scene"]["value"].setValue( '${script:name}' )
Gaffer.Metadata.registerValue( parent["variables"]["imageCataloguePort"], 'readOnly', True )
Gaffer.Metadata.registerValue( parent["variables"]["projectName"]["name"], 'readOnly', True )
Gaffer.Metadata.registerValue( parent["variables"]["projectRootDirectory"]["name"], 'readOnly', True )
__children["Sphere"]["transform"]["translate"].setValue( imath.V3f( -3.30550456, 0, 0 ) )
__children["Sphere"]["__uiPosition"].setValue( imath.V2f( -21.9251881, 0.674613714 ) )
__children["Cube"]["transform"]["translate"].setValue( imath.V3f( 2.56078744, 0, 0 ) )
__children["Cube"]["__uiPosition"].setValue( imath.V2f( -8.92518902, 0.67458421 ) )
__children["Camera"]["transform"]["translate"].setValue( imath.V3f( 0, 0, 9.70609951 ) )
__children["Camera"]["__uiPosition"].setValue( imath.V2f( -34.9251862, 0.676215708 ) )
__children["Parent"]["in"].setInput( __children["Camera"]["out"] )
__children["Parent"]["parent"].setValue( '/' )
__children["Parent"]["children"][0].setInput( __children["Sphere"]["out"] )
__children["Parent"]["children"][1].setInput( __children["Cube"]["out"] )
__children["Parent"]["__uiPosition"].setValue( imath.V2f( -21.4251862, -7.48947859 ) )
__children["Backdrop"]["title"].setValue( 'Crop Debug' )
__children["Backdrop"]["description"].setValue( 'import GafferScene\n\ndef timeTravel( hh ) :\n\tprint hh.scene.fullName()\n\tfor p in hh.predecessors :\n\t\ttimeTravel( p )\n\nh = GafferScene.SceneAlgo.history(\n\troot[\'InteractiveAppleseedRender\'][\'in\']["globals"],\n\tIECore.InternedStringVectorData([])\n)\n\ntimeTravel( h )' )
__children["Backdrop"]["__uiPosition"].setValue( imath.V2f( 10.2572021, -8.59491062 ) )
__children["Backdrop"]["__uiBound"].setValue( imath.Box2f( imath.V2f( -10, -19.4131889 ), imath.V2f( 34.2592621, 10 ) ) )
Gaffer.MetadataAlgo.setNumericBookmark( __children["StandardOptions"].scriptNode(), 3, __children["StandardOptions"] )
__children["StandardOptions"]["in"].setInput( __children["Parent"]["out"] )
__children["StandardOptions"]["options"]["renderCamera"]["value"].setValue( '/camera' )
__children["StandardOptions"]["options"]["renderCamera"]["enabled"].setValue( True )
__children["StandardOptions"]["options"]["renderCropWindow"]["value"].setValue( imath.Box2f( imath.V2f( 0, 0 ), imath.V2f( 0.786226869, 1 ) ) )
__children["StandardOptions"]["options"]["renderCropWindow"]["enabled"].setValue( True )
__children["StandardOptions"]["__uiPosition"].setValue( imath.V2f( -26.48209, -17.7870846 ) )
__children["Outputs"]["in"].setInput( __children["CustomOptions"]["out"] )
__children["Outputs"]["outputs"]["output1"]["name"].setValue( 'Interactive/Beauty' )
__children["Outputs"]["outputs"]["output1"]["fileName"].setValue( 'beauty' )
__children["Outputs"]["outputs"]["output1"]["type"].setValue( 'ieDisplay' )
__children["Outputs"]["outputs"]["output1"]["data"].setValue( 'rgba' )
__children["Outputs"]["__uiPosition"].setValue( imath.V2f( -26.48209, -33.8850021 ) )
Gaffer.MetadataAlgo.setNumericBookmark( __children["InteractiveAppleseedRender"].scriptNode(), 2, __children["InteractiveAppleseedRender"] )
__children["InteractiveAppleseedRender"]["in"].setInput( __children["Outputs"]["out"] )
__children["InteractiveAppleseedRender"]["__uiPosition"].setValue( imath.V2f( -26.48209, -42.0490646 ) )
Gaffer.MetadataAlgo.setNumericBookmark( __children["Catalogue"].scriptNode(), 1, __children["Catalogue"] )
__children["Catalogue"]["__mapping"].setValue( IECore.CompoundData({'Image':IECore.IntData( 0 )}) )
__children["Catalogue"]["__uiPosition"].setValue( imath.V2f( -9.64779663, -39.0491066 ) )
__children["CustomOptions"]["enabled"].setInput( __children["Expression"]["__out"]["p0"] )
__children["CustomOptions"]["in"].setInput( __children["StandardOptions"]["out"] )
__children["CustomOptions"]["__uiPosition"].setValue( imath.V2f( -26.48209, -25.7209396 ) )
__children["Expression"]["__in"]["p0"].setInput( __children["CustomOptions"]["in"]["globals"] )
__children["Expression"]["__uiPosition"].setValue( imath.V2f( -18.2162209, -25.7200851 ) )
__children["Expression"]["__engine"].setValue( 'python' )
__children["Expression"]["__expression"].setValue( 'g = parent["__in"]["p0"]\nparent["__out"]["p0"] = False' )


del __children

@danieldresser-ie
Copy link
Contributor

Interesting note: I happened to be on my very brute force hash cache validator branch when I was testing this, and that caused it to work.

My hypothesis for the cause is something like: it hashes the upstream globals in the process of computing the enabled plug, but notes that the enabled connection doesn't count as "flowing through a scene connection", so it doesn't include this in the history.

Then, it eventually gets to the upstream globals connection, and hashes the input globals in a context that would count as "flowing through a scene connection" ... but by that time, they've already been hashed, and are just pulled out of the hash cache, without continuing the history capture.

@andrewkaufman andrewkaufman changed the title 2d CropWindowTool not working on certain production setups. GafferScene.SceneAlgo.history not working on common production setups Aug 11, 2020
@andrewkaufman andrewkaufman changed the title GafferScene.SceneAlgo.history not working on common production setups GafferScene.SceneAlgo.history not working on common production setups Aug 11, 2020
@andrewkaufman andrewkaufman changed the title GafferScene.SceneAlgo.history not working on common production setups SceneAlgo::history not working on common production setups Aug 11, 2020
@johnhaddon
Copy link
Member

Relates to #3875.

@johnhaddon
Copy link
Member

Closing - this was fixed in #4568 and released in 1.0.0.0. Output from the code in the backdrop now includes the StandardOptions node as expected :

gui.scripts.ScriptNode1.InteractiveAppleseedRender.in
gui.scripts.ScriptNode1.Outputs.out
gui.scripts.ScriptNode1.Outputs.in
gui.scripts.ScriptNode1.CustomOptions.out
gui.scripts.ScriptNode1.CustomOptions.in
gui.scripts.ScriptNode1.StandardOptions.out
gui.scripts.ScriptNode1.StandardOptions.in
gui.scripts.ScriptNode1.Parent.out
gui.scripts.ScriptNode1.Parent.in
gui.scripts.ScriptNode1.Camera.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants