ID 608019 - The Shuffle node's fromInput1 and fromInput2 knobs can trigger knobChanged callbacks while a file is being Cleared

Follow

Problem summary:
The Shuffle node's fromInput1 and fromInput2 knobs can trigger knobChanged callbacks while a file is being Cleared
 
Customer reported version:
Nuke 14.1v7
 
Customer reported platform:
Rocky 9
 
Steps to reproduce:
1) Launch Nuke and paste the following nodes into the Node Graph:

CheckerBoard2 { inputs 0 name CheckerBoard1}CheckerBoard2 { inputs 0 name CheckerBoard2}Shuffle2 { inputs 2 fromInput1 {  {0}  B  A } fromInput2 {  {0}  B  A } name Shuffle1}
2) Open the Script Editor and execute the following code to add a knobChanged callback:
def knob_printer():     knob = nuke.thisKnob()     print(f"{knob.name()} changed to {knob.value()}")     nuke.addKnobChanged(knob_printer)
3) Perform at least one of the actions below:
    i) Connect a node to the Shuffle's output, such as a Grade node
    ii) View the Shuffle node
    iii) Double click the Shuffle to open its Properties
 
4) Navigate to File > Clear and observe how the Shuffle's fromInput knobs fire the knobChanged callback:
fromInput1 changed to {0} B fromInput2 changed to {0} B
 
Alternative Steps:
1) Open the attached example_file.nk
2) Navigate to File > Clear and observe the ValueError: A PythonObject is not attached to a node errors
 
Expected behavior:
The Shuffle node's fromInput knobs should not trigger knobChanged callbacks when a Nuke script is cleared.
 
Actual behavior:
If a Nuke script that contains a Shuffle node is cleared, it's possible for the Shuffle's fromInput knobs to trigger knobChanged callbacks, despite the knobs not changing. This can lead to ValueError: A PythonObject is not attached to a node warnings as knobChanged callbacks are executing after the script has been cleared.
 
If the Shuffle's inputs are swapped (so Input B is CheckerBoard1, and Input A is CheckerBoard2), the callback will not be triggered (unless the Shuffle's fromInput knob(s) are also switched from "B" to "A").
 
Workaround:
No known workaround at this time.
 
Reproduced by Support in:
Nuke 16.0v6 - Windows 11, macOS 14 Sonoma
Nuke 15.0v1 - Windows 10
Nuke 14.0v1 - Windows 10
Nuke 13.0v1 - Windows 10
 
Earliest version tested:
Nuke 13.0v1 - This issue appears to be in all tested versions of the product

    We're sorry to hear that

    Please tell us why