Custom StandarOptions setup

36 views
Skip to first unread message

Pablo Gimenez Pizarro

unread,
Aug 13, 2026, 6:47:48 AM (13 days ago) Aug 13
to gaffer-dev
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!

dan...@image-engine.com

unread,
Aug 13, 2026, 9:17:03 PM (12 days ago) Aug 13
to gaffer-dev
Sorry I missed this message this morning.

The issue here appears to be that you're trying to set the expression before parenting the Expression node anywhere. If you've got a freshly created Expression node, it doesn't have any parent to reference yet. If you're adding the StandardOptions and the Expression to the script or something, then you could add both nodes to the script first, and then set the expression. Or you could do something like packaging them together in a Box and returning the Box - once both nodes are added to the Box, the setExpression will work.

The syntax of setting the expression all looks fine, at least it works here in the Python Editor once I parent the Expression.

-Daniel

Pablo Gimenez Pizarro

unread,
Aug 14, 2026, 7:02:00 AM (12 days ago) Aug 14
to gaffer-dev
Thanks Dan.
Yes I figured it by myself the next day :).
It took a while to get the message in the discussion group, but messing around with the code the next day and found the issue, this is the kind of things you have to learn when you are dealing with a new platform.
BTW, what is the preferred way communicate things around Gaffer, this discussion group or Discord ... or both :)

John Haddon

unread,
Aug 14, 2026, 7:03:48 AM (12 days ago) Aug 14
to gaffer-dev
On Friday, August 14, 2026 at 12:02:00 PM UTC+1 pablo....@ilpvfx.com wrote:
BTW, what is the preferred way communicate things around Gaffer, this discussion group or Discord ... or both :)
 
In theory, I think we prefer this group, because it's searchable on the open web. But in practice we go wherever the users are, and most folks seem to prefer Discord...
 

Pablo Gimenez Pizarro

unread,
Aug 14, 2026, 11:45:53 AM (12 days ago) Aug 14
to gaffer-dev
Yes I also prefer this
Reply all
Reply to author
Forward
0 new messages