ID 368676 - Setting codec by 'Dropdown Name' causes incorrect behaviour depending on codec

Follow

Problem summary
Within Nuke, setting Write node codecs on new nodes by dropdown name, does not work for all codecs.

For example, copy/pasting the following Write node into the Node Graph with a codec set to 'Apple ProRes 4444 XQ', will actually set it to 'Avid DNxHD Codec':

Write {
file_type mov
codec "Apple ProRes 4444 XQ"
name "Write1"
selected true
xpos -84
ypos -440
}

If the codec is changed to 'Apple ProRes 4444', the correct codec appears:  ( Throws Exception on Mac10.13 )
Write {
file_type mov
codec "Apple ProRes 4444"
name "Write1"
selected true
xpos -84
ypos -440
}

The Legacy codecs do not get created at all and throw exceptions.  
These nodes are set to the 'default' codec instead:
Write {
file_type mov
codec "BMP"
name "Write1"
selected true
xpos -84
ypos -440
}

Customer reported version
nuke.11.2v3

Customer reported platform
centos6

Steps to reproduce

1) Copy/Paste each snippet posted above into the Node Graph.

2) Check each Write node's Codec

Result:     1.  Wrong codec is added

2.  Correct codec is added ( Windows 7 & CentOS6.9 Only, exception on Mac10.13 )

3.  Exception is thrown on creation, defaults codec


Workaround

1.  Set the codec via index value

Within the Meta_Codec knob of the Write node, the codecs are listed within an Enumeration knob.


For example, If you would like to set 'Apple ProRes 4444 XQ' as the codec, you need to reference index '7':

Write {
file_type mov
codec 7
name "Write1"
selected true
xpos -84
ypos -440
}

2.  Set codec by correct codec name

When copying a Write node, it will display the naming scheme Nuke uses for the 'mov' codecs.


For example, 'Apple ProRes 4444 XQ' is actually 'ap4x' when copied.


Using this value will provide the correct codec:

Write {
file_type mov
meta_codec ap4x
name Write1
selected true
xpos -241
ypos -39
}

3.  Use the Index value for the codecs on User GUI Creation with Python


Adding the following 'addOnUserCreate' callback to your menu.py , will automatically set new Write nodes to 'mov' with the correct codec:

def setCodec():
node = nuke.thisNode()
node.knob('file_type').setValue('mov')
node.showControlPanel() # Update node with 'mov' knobs displayed
node.knob('meta_codec').setValue(7) # Apple ProRes 4444 XQ


nuke.addOnUserCreate(setCodec, nodeClass="Write")

Reproduced by support

This bug has been reproduced in:
Nuke11.2v4 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.2v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.1v4 - Windows 7
Nuke11.1v1 - Windows 7
Nuke11.0v4 - Windows 7
Nuke11.0v1 - Windows 7
Nuke10.5v7 - Windows 7
Nuke10.5v1 - Windows 7
Nuke10.0v6 - Windows 7
Nuke10.0v1 - Windows 7
Nuke9.0v9 - Windows 7
Nuke9.0v1 - Windows 7
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
Exact codec names should be available as an option when adding codecs.

Actual behaviour
Adding codec by name causes exceptions.


    We're sorry to hear that

    Please tell us why