diff --git a/Changes.md b/Changes.md index 1d6a5352afa..d2544a99f4e 100644 --- a/Changes.md +++ b/Changes.md @@ -44,6 +44,8 @@ Fixes - Stopped failed jobs jumping to the end of the Local Jobs UI. - Fixed message log update. - Fixed `Job.statistics()` errors on Windows, ensuring that a `pid` is always returned when available. +- NodeMenu/NodeEditor : `userDefault` metadata is now evaluated in the script context, so it can depend on script variables. + API --- diff --git a/python/GafferUI/NodeEditor.py b/python/GafferUI/NodeEditor.py index 9f78ecb087d..20394c0bb88 100644 --- a/python/GafferUI/NodeEditor.py +++ b/python/GafferUI/NodeEditor.py @@ -233,7 +233,8 @@ def applyDefaults( graphComponent ) : node = self.nodeUI().node() with Gaffer.UndoScope( node.ancestor( Gaffer.ScriptNode ) ) : applyDefaults( node ) - Gaffer.NodeAlgo.applyUserDefaults( node ) + with node.ancestor( Gaffer.ScriptNode ).context(): + Gaffer.NodeAlgo.applyUserDefaults( node ) def __applyReadOnly( self, readOnly ) : diff --git a/python/GafferUI/NodeMenu.py b/python/GafferUI/NodeMenu.py index c70e31fcb77..4fafd7906d6 100644 --- a/python/GafferUI/NodeMenu.py +++ b/python/GafferUI/NodeMenu.py @@ -116,7 +116,8 @@ def f( menu ) : if node is None : return - Gaffer.NodeAlgo.applyUserDefaults( node ) + with script.context(): + Gaffer.NodeAlgo.applyUserDefaults( node ) for plugName, plugValue in plugValues.items() : node.descendant( plugName ).setValue( plugValue )