ID 354080 - Nuke hangs if user adds knob to node with large amount of User knobs when the Properties panel is open

Follow

Problem summary
When adding custom User knobs to nodes via Python, if the node has a large amount of custom User knobs already, Nuke will hang each time a new knob is added.

This hang appears to occur only when the Properties Bin of the Node is open.

If the Properties Bin is closed and a new knob is created via Python, there is no hang.

Customer reported version
nuke.10.0v4

Customer reported platform
centos7

Steps to reproduce

1) Open Nuke, create any node

2) Double click the node so it is open in the Properties Bin, keep it selected

3) Copy/Paste and execute the following snippet into the Script Editor:

selectedNode = nuke.selectedNode()index = 0while index < 50:    newKnobName = 'newKnob_' + str(index)    newKnob = nuke.Double_Knob( newKnobName, newKnobName )    selectedNode.addKnob(newKnob)    index += 1

You will notice that Nuke will slightly hang before adding the batch of knobs


4) Repeat step 3, notice that it the hang is considerably longer.

5) Follow steps 1,2,3,4 again, but CLOSE the node's properties bin panel.

Result:  The functions will execute immediately and there will be no hang, the node will have all the added knobs.

Workaround
Closing the Properties bin before adding knobs works fine.

If you wish to add the Knobs while the Properties Bin is open, you can use a QTimer to hide the bin, run the code, then reopen with much less lag:

 


from PySide2 import QtCoreimport timedef createKnobs(node):    for i in xrange( 50 ):        k = nuke.Double_Knob( "test_{}".format( i + 1 ) )        node.addKnob( k )    print "nuke.nodes.NoOp took: {0} to add 50 knobs".format( time.time() - start )    # Show the contol panel    node.showControlPanel()    print "nuke.nodes.NoOp took: {0} to show control panel".format(time.time() - start )node = nuke.createNode( "NoOp", inpanel=True )# Delay createKnobs definition to run after the control panel is closednode.hideControlPanel()QtCore.QTimer.singleShot(0, lambda : createKnobs(node))
 
Reproduced by support

This bug has been reproduced in:
Nuke11.1v4 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.1v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.0v4 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.0v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke10.5v7 - Windows 7
Nuke10.5v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke10.0v6 - Windows 7
Nuke10.0v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke9.0v9 - Windows 7
Nuke9.0v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke8.0v7 - Windows 7
Nuke7.0v10 - Windows 7 - Mac10.13 - CentOS6.9

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

Expected behaviour
Nuke's Properties panel should not hang when adding or altering knobs.

Actual behaviour
If the node is visible in the Properties panel, the program will hang when adding a new knob ( If there is already a large amount of User knobs).

    We're sorry to hear that

    Please tell us why