GafferHQ / gaffer

Gaffer is a node-based application for lookdev, lighting and automation
http://www.gafferhq.org
BSD 3-Clause "New" or "Revised" License
960 stars 206 forks source link

Spreadsheet row deletion and expression node #4614

Closed lucienfostier closed 2 years ago

lucienfostier commented 2 years ago

Version: Gaffer 0.61.5.0

Description

I have a Box node with a Spreadsheet node and an expression inside. Some of the cells in the spreadsheet are driven by an image plug child of the box. When I remove a row from the promoted spreadsheet I get the following traceback( see debug log )

Steps to reproduce

  1. run the following code in the python editor
    
    import inspect
    box = Gaffer.Box()
    root.addChild( box )
    box.addChild( GafferImage.ImagePlug( "test") )
    spreadsheet = Gaffer.Spreadsheet()
    spreadsheet["rows"].addColumn( Gaffer.V2iPlug( "resolution" ) )
    spreadsheet["rows"].addColumn( Gaffer.FloatPlug( "pixelAspect" ) )
    spreadsheet["rows"].addColumn( Gaffer.BoolPlug( "deep" ) )
    spreadsheet["rows"].addColumn( Gaffer.StringPlug( "importPath" ) )
    box.addChild( spreadsheet )
    expression = Gaffer.Expression()
    box.addChild( expression )

Gaffer.PlugAlgo.promote(spreadsheet["rows"] ) row = box["rows"].addRow() row["name"].setValue("test" ) expression.setExpression( inspect.cleandoc( """ import imath import Gaffer import IECoreImage width = parent["test"]["format"].width() height = parent["test"]["format"].height() pa = parent["test"]["format"].getPixelAspect() deep = parent["test"]["deep"] fileSequence = IECore.ls( parent["rows"]["row1"]["cells"]["importPath"]["value"] ) if fileSequence: frameList = fileSequence.frameList.asList() header = IECoreImage.ImageReader.create( fileSequence.fileNameForFrame( frameList[0] ) ).readHeader() width = header["displayWindow"].value.size().x height = header["displayWindow"].value.size().y pa = header["PixelAspectRatio"].value deep = header["deep"].value parent["rows"]["row1"]["cells"]["resolution"]["value"] = imath.V2i( width, height ) parent["rows"]["row1"]["cells"]["pixelAspect"]["value"] = pa parent["rows"]["row1"]["cells"]["deep"]["value"] = deep """ ), "python" )

2. show the box property in the node editor
3. right click on the row named "test"
4. select delete row

### Debug log ###

<details>
<summary>Click to Expand</summary><p>

<!-- Optional: Insert debug log output below -->

Traceback (most recent call last): File "/software/apps/gaffer/0.61.5.0/cent7.x86_64/cortex/10.3/gaffer/py2/python/GafferUI/Widget.py", line 955, in eventFilter return self.mouseButtonDblClick( qObject, qEvent ) File "/software/apps/gaffer/0.61.5.0/cent7.x86_64/cortex/10.3/gaffer/py2/python/GafferUI/Widget.py", line 1118, in mouseButtonDblClick return widget._buttonDoubleClickSignal( widget, event ) IECore.Exception: Object "Box1" is not an ancestor of "value". Traceback (most recent call last): File "/software/apps/gaffer/0.61.5.0/cent7.x86_64/cortex/10.3/gaffer/py2/python/GafferUI/Widget.py", line 955, in eventFilter return self.mouseButtonDblClick( qObject, qEvent ) File "/software/apps/gaffer/0.61.5.0/cent7.x86_64/cortex/10.3/gaffer/py2/python/GafferUI/Widget.py", line 1118, in mouseButtonDblClick return widget._buttonDoubleClickSignal( widget, event ) IECore.Exception: Object "Box1" is not an ancestor of "value".


</p>
</details>
johnhaddon commented 2 years ago

I can't reproduce this in the official GafferHQ builds - have you tested your repro in isolation in one of those? I'm wondering if this is an issue with the IE build, or maybe there is some additional code in your original setup which is necessary to trigger the problem.

johnhaddon commented 2 years ago

Chatted to @danieldresser-ie about this, and it seems like there's a missing step :

  1. Go inside the box, double click to open the NodeEditor for the Expression node.