ID 441728 - Pasting nodes, via Python, after a callback which queries the ViewerProcess and also after creating a Viewer node breaks downstream connections from Group nodes

Follow

Problem summary
Pasting nodes, via Python, after a callback which queries the ViewerProcess and also after creating a Viewer node breaks downstream connections from Group nodes.

The issue seems to only affect Group nodes, and only affects their downstream connections - the Group nodes' input remain connected.

 

Customer reported version
Nuke 12.0v4

 

Customer reported platform
CentOS 7

 

Steps to reproduce

1) Open Nuke and ensure that you have a completely clear script (File > Clear).

2) Create a Group node and connect any node downstream.

3) Save the script and close it.

4) Run the following code in the Script Editor, where "/path/to/some/script.nk" is the path to the script you saved in step 3.


nuke.addOnCreate(nuke.ViewerProcess.node, nodeClass='Group')nuke.createNode('Viewer')path = "/path/to/some/script.nk"nuke.nodePaste(path)

Result: The script downstream from the Group node is disconnected.

 

Pasting nodes from the clipboard also has the same issue. For example:


nuke.addOnCreate(nuke.ViewerProcess.node, nodeClass='Group')nuke.createNode('Viewer')nuke.nodePaste("%clipboard%")

 

The issue can also be reproduced with the scriptSource() and scriptReadFile() methods:


nuke.addOnCreate(nuke.ViewerProcess.node, nodeClass='Group')nuke.createNode('Viewer')path = "/path/to/some/script.nk"nuke.scriptSource(path)

Or:


nuke.addOnCreate(nuke.ViewerProcess.node, nodeClass='Group')nuke.createNode('Viewer')path = "/path/to/some/script.nk"nuke.scriptReadFile(path)

 

Expected behaviour
The Group nodes' connections should be the same as the original script.

 

Actual behaviour
Pasting nodes, via Python, after a callback which queries the ViewerProcess and after creating a Viewer node breaks downstream connections from Group nodes.

 

Workaround
Firstly, a QTimer may allow you to workaround this problem. For example:


from PySide2.QtCore import QTimerdef viewerProcess():    QTimer.singleShot(0, lambda: nuke.ViewerProcess.node)nuke.addOnCreate(viewerProcess, nodeClass='Group')nuke.createNode('Viewer')path = "C:\\temp\\temp_scripts\\script.nk"nuke.nodePaste(path)

 

Alternatively, creating the Viewer node after the nodePaste() method is called also appears to work:


from PySide2.QtCore import QTimernuke.addOnCreate(nuke.ViewerProcess.node, nodeClass='Group')path = "/path/to/some/script.nk"nuke.nodePaste(path)v = nuke.createNode('Viewer')for i in range(v.inputs()): v.setInput(i, None)

 

Reproduced by support

This bug has been reproduced in:
Nuke 12.1v4 - Windows 10 - macOS 10.13 (High Sierra) - Linux CentOS 7

Nuke 12.0v1 - Windows 10

Nuke 11.0v1 - Windows 10

Nuke 10.0v1 - Windows 10

Nuke 9.0v1 - Windows 10

Nuke 8.0v1 - Windows 10 - macOS 10.13 (High Sierra)

 

Earliest version tested
Nuke 8.0v1
- This issue appears to be in all versions of the product

    We're sorry to hear that

    Please tell us why