Hello, newby question here, starting to get my head around with Gaffer.
So in my baby steps into learning Gaffer I'm trying to get some basic integration in our pipeline, first thing I have done is creating context variables for things like output resolution shot name, and so on ...
Now I'm trying to customize a version of Standard Options to use them.
My first approach is to have a custom menu entry that creates a Standard Options node and then create Expression Nodes to connect python expressions to plugs in the options node and connect them to my context variables.
So in my custom menu entry in the postCreator function I have something like:
expression = Gaffer.Expression("ContextResolution")
expression.setExpression(f"parent[\"myStandardOptions\"][\"options\"][\"render:resolution\"][\"value\"][\"x\"] = 1024")
Is just for testing, not reading the context variables at the moment, the menu entry is creating the StandardOptions node with name myStandardOptions but is not creating the expression node.
Instead I got this error:
Traceback (most recent call last):
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/Gaffer/WeakMethod.py", line 65, in __call__
return self.__method( s, *args, **kwArgs )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/GafferUI/Menu.py", line 210, in __actionTriggered
item.command( *args, **kw )
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/GafferUI/NodeMenu.py", line 149, in f
postCreator( node, menu )
File "/ice/rez/packages/local/pagp/gaffer_plugins/3.18.2dev/platform-linux/os-Rocky-9/centos7_libs-0/python-3.11/startup/gui/IlpStandardOptions.py", line 38, in __ilpStandardOptionsPostCreator
expression.setExpression("parent[\"myStandardOptions\"][\"options\"][\"render:resolution\"][\"value\"][\"x\"] = 1024")
IECore.Exception: Traceback (most recent call last):
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/Gaffer/PythonExpressionEngine.py", line 64, in parse
outPlugs.extend( [ self.__plug( node, p ) for p in self.__outPlugPaths ] )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/Gaffer/PythonExpressionEngine.py", line 64, in <listcomp>
outPlugs.extend( [ self.__plug( node, p ) for p in self.__outPlugPaths ] )
^^^^^^^^^^^^^^^^^^^^^^
File "/ice/rez/packages/local/pagp/gaffer/
1.6.20.0/platform-linux/.gcc-11/python/Gaffer/PythonExpressionEngine.py", line 212, in __plug
plug = plug[p]
~~~~^^^
TypeError: 'NoneType' object is not subscriptable
I have tested escaping and not escaping the quotes, using a f-string and node.getName() instead of a hardcoded name, always get the same error.
Looks like Gaffer is somehow parsing the string in the expression even before is evaluated in python.
I'm most probably not approaching this from the correct angle, I have also seen there is another node Context Query, which is probably better than using expressions, well any suggestion of how to approach this in Gaffer is welcome.
In Houdini I will just do a new HDA with some default expressions in their parameters to query shotgun for the shot info, here I already have the SG query solved when I initialize the context variables but need a way to create a Standard Options node that use these variables in some of it's parameters automatically.
Thanks!