Problem summaryThe PyScript_Knob keyword arguments (kwargs) are not being called correctly within the function, when created in a node.
This is based on the following recommended usage within the documentation, where setting the command kwarg will work regardless of sequential order.
https://learn.foundry.com/nuke/developers/120/pythonreference/nuke.PyScript_Knob-class.htmlNote: This also occurs with the 'label' kwarg within the PyScript_Knob.
Customer reported versionnuke.11.2v5
Customer reported platformSteps to reproduce1) In a new Nuke session, open the Script Editor
2) Paste the following snippet into the Script Editor and run (select all and ctrl+enter)
n = nuke.createNode("NoOp")
k = nuke.PyScript_Knob("name", "label", command="nuke.message('Command Executed...')")
n.addKnob(k)
This will create a
NoOp node with a
PyScript_Knob (label) button that uses the 'command' kwarg to call an action.
3) Click the 'label' button.
Result: Button does not call the command argument correctly.
4) Remove the last snippet from the Script Editor, paste in the following snippet and run.
n = nuke.createNode("NoOp")
k = nuke.PyScript_Knob("name", "label", "nuke.message('Command Executed...')")
n.addKnob(k)
This will create a
NoOp node with a
PyScript_Knob (label) button that
does not use a kwarg to call 'command', but does it through sequential ordering.
5) Click the 'label' button.
Result: command argument works as expected.
6) To confirm the expected result, run the following snippet in the Script Editor, using a kwarg in a menu item:
m= nuke.menu("Nuke")
c= m.addMenu(name='newMenu')
c.addCommand("Command Test", command="nuke.message('Command Executed...')")
This will create a new menu item called 'newMenu' with a command kwarg being called through the 'Command Test' item.
7) Within the new menu item, select 'Command Test'.
Result: Runs the command argument correctly.
Expected behaviourThe PyScript_Knob function should correctly interpret kwargs
Actual behaviourThe PyScript_Knob function does not correctly interpret kwargs
WorkaroundAs mentioned through the above testing, our suggestion would be to use sequential ordering and when using the PyScript_Knob function, as per below:
n = nuke.createNode("NoOp")
k = nuke.PyScript_Knob("name", "label", "nuke.message('Command Executed...')")
n.addKnob(k)
Reproduced by supportThis bug has been reproduced in:
Nuke 12.0v1 - Windows 7 - MacOS 10.14.5 - CentOS 7
Nuke 11.3v1 - Windows 7
Nuke 11.2v1 - Windows 7
Nuke 11.1v1 - Windows 7
Nuke 11.0v1 - Windows 7
Nuke 10.5v1 - Windows 7
Nuke 10.0v1 - Windows 7
Nuke 9.0v1 - Windows 7
Nuke 8.0v1 - Windows 7 - MacOS 10.14.5 - CentOS 7
Earliest version testedNuke 8.0v1
- This issue appears to be in all versions of the product