ID 595867 - Knobs containing GSVs do not always return the correct result when evaluated via Python

Follow

Problem summary:
Knobs containing GSVs do not always return the correct result when evaluated via Python
 
Customer reported version:
Nuke 16.0v1
 
Customer reported platform:
Windows 11
 
Steps to reproduce:
1) Launch Nuke and open the Script Editor
2) Paste in the following lines and execute this code:

root_node = nuke.root() gsv_knob = root_node['gsv'] gsv_knob.setGsvValue('__default__.shot', 'test') write = nuke.createNode("Write") write['file'].setValue("%shot") print(f"Write node GSV evaluates correctly to: {write['file'].evaluate()}") text = nuke.createNode("Text2") text['message'].setValue("%shot") print(f"Text node GSV evaluates incorrectly to: {text['message'].evaluate()}")
3) Observe the output, where the Text node's GSV is not resolved and returns %shot:

 
Expected behavior:
When evaluating a knob with Python, any Graph Scope Variables should always be expanded and return the resolved result.
 
Actual behavior:
If a GSV is present in a knob, the Knob.evaluate() method does not always return the correct expanded result and may return the same output as the Knob.getText() method.
 
This issue does not seem to be specific to certain knob types, as the Write node's File_Knob does return resolved GSVs when the .evaluate() method is called, but a File_Knob added to a NoOp node does not resolve the GSV:
root_node = nuke.root() gsv_knob = root_node['gsv'] gsv_knob.setGsvValue('__default__.shot', 'test') write = nuke.createNode("Write") write['file'].setValue("%shot") print(f"Write node's GSV on a {type(write['file'])} evaluates correctly to: {write['file'].evaluate()}") noop = nuke.createNode('NoOp') file_knob = nuke.File_Knob("file","File") noop.addKnob(file_knob) noop["file"].setValue("%shot") print(f"NoOp node's GSV on a {type(noop['file'])} evaluates incorrectly to: {noop['file'].evaluate()}")

 
Workaround:
No known workaround at this time.
 
Reproduced by Support in:
Nuke 16.0v1 - Windows 11, macOS 14 Sonoma
Nuke 15.2v1 - Windows 11
 
Earliest version tested:
Nuke 15.2v1 - This feature (GSV) did not exist before this version
 

    We're sorry to hear that

    Please tell us why