ID 599507 - Knobs containing GSVs stop evaluating via Python if any GSVs are created, changed, or removed

Follow

Problem summary:
Knobs containing GSVs stop evaluating via Python if any GSVs are created, changed, or removed 
 
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', "0100", nuke.gsv.DataType.List) gsv_knob.setGsvValue('__default__.seq', "pizza_party") gsv_knob.setListOptions("__default__.shot", ["0100", "0200"]) write = nuke.createNode("Write") write['file'].setValue("%{seq}_%{shot}") print(f"Write node GSV evaluates correctly to: {write['file'].evaluate()}") 
3) Perform any of the following actions:
    a) Create a new GSV using the UI or Python: gsv_knob.setGsvValue("__default__.test", "temp_value")
    b) Change one of your new GSVs using the UI or Python: gsv_knob.setGsvValue("__default__.shot", "0200")
    c) Remove one of your new GSVs using the UI or Python: gsv_knob.removeGsv("__default__.shot")
4) Run the following line of code in the Script Editor:
print(f"Write node GSV evaluates incorrectly to: {write['file'].evaluate()}")
5) Compare the results, noting that the Write node's GSVs are no longer evaluated:

 
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 will stop working if any GSVs are created, removed, or adjusted.
 
Workaround:
After a GSV has been added, deleted, or changed, setting the knob to an empty string before restoring its original value seems to allow the evaluate() method to produce the expected results:
tmp = write['file'].getValue() write['file'].setValue("") write['file'].setValue(tmp) print(f"Write node GSV evaluates correctly to: {write['file'].evaluate()}")
 
Reproduced by Support in:
Nuke 16.0v2 - 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