ID 149139 - nuke.Channel_Knob function not being saved on reopen and copy & paste

Follow

Problem summary
When using the 'nuke.Channel_Knob' python function to create a custom channel selection in a node, when the node is altered through copying, calling through a gizmo or saving and re-opening the script, the values will change from your custom values and loose the 'all' channels selection.

Customer reported version
nuke.10.0v6

Customer reported platform
centos6

Steps to reproduce

1) Open a new Nuke script

2) Paste the following code snippet into the script editor (to create a NoOp node with a custom channel knob)


node = nuke.createNode('NoOp') channel_knob = nuke.Channel_Knob('c', "channels") channel_knob.setValue('rgba') node.addKnob(channel_knob)


3) Run the script using the 'ctrl + enter' shortcut within script editor to create the NoOp1 node

4) Once the NoOp1 node is created, view the available channels in the channel knob dropdown (see below)



5) Copy the NoOp1 node and paste to the create the NoOp2 node

6) View the channel dropdown of the NoOp2 node
Result: The 'all' channels option is removed and the 'other layers' now exists outside of the 'other layers' folder (see below)


Note: In this reproduction we copied the NoOp node, but the same will occur in any instance where the function requires to be stored in the node itself eg. making a gizmo or saving/re-opening the script.

Workaround
There are two workarounds to this issue:

1)  Within a Gizmo, create a Remove node, set the value to 'keep' and the channels to 'all' and call this knob through the Gizmo's controls. This operation could also be done through Python using the nuke.Link_Knob and nuke.nodes.Remove functions respectively.

2) Within a Gizmo, create a 'Custom Python Button' to select the missing 'all' value, Replacing the 'channelKnobName' value with your created knobs name using the following snippet.


nuke.thisNode().knob('channelKnobName').setValue('all')

The caveat of this second method would be that the user will have to select this each time they require all channels.

Reproduced by support
This bug has been reproduced in:

Nuke 11.1v4 - Windows 7 - MacOS 10.13.4 - CentOS 6.9
Nuke 11.1v1 - Windows 7 
Nuke 11.0v4 - Windows 7 
Nuke 11.0v1 - Windows 7 
Nuke 10.5v7 - Windows 7
Nuke 10.5v1 - Windows 7 
Nuke 10.0v6 - Windows 7
Nuke 10.0v1 - Windows 7
Nuke 9.0v9 - Windows 7
Nuke 9.0v1 - Windows 7
Nuke 8.0v7 - Windows 7
Nuke 8.0v1 - Windows 7
Nuke 7.0v10 - Windows 7 - MacOS 10.13.4 - CentOS 6.9

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

Expected behaviour
The custom channel_knob should retain the original information when copied or the script is saved/re-opened or creating as a gizmo

Actual behaviour
The custom channel_knob does not retain the values after altering the node through copying, saving/re-opening the script or creating as a gizmo

    We're sorry to hear that

    Please tell us why