ID 508677 - nameRegExFind and nameRegExReplace does not sanitize invalid characters

Follow

Problem summary
When exposing parameters in a shading node, invalid characters for the parameter name (such as '&') will be automatically sanitized to an underscore to maintain a valid parameter name.
 
However, if you use the nameRegExFind and nameRegExReplace, it is possible to enter an invalid character that does not go through the same sanity check, creating an invalid parameter name.
 
Customer reported version
katana.4.0v5
 
Customer reported platform
centos7
 
Steps to reproduce
1) Create a DlShadingNode node and set the shader type to blinn
2) Edit Material Interface Options of the Diffuse parameter and set the Name to "replace_test"
3) Set the nameRegExFind parameter to "replace"
4) Set the nameRegExReplace parameter to "foo & bar"
5) Connect this DlShadingNode to the dlSurface input of a NetworkMaterial to create a material
6) Create and attach a Material node
7) Set the action parameter to ‘create a child material’
8) Set the inheritsFrom parameter to ‘/root/materials/NetworkMaterial’
9) Set key frames on the foo & bar_test parameter
 
Expected behavior
The blinn parameter is sanitized to "foo _ bar_test"
 
Actual behavior
The parameter is not sanitized. If you attempt to animate this parameter, the Katana file will become invalid and Katana will be unable to save.
 
The following error is thrown:

[ERROR python.root]: A RuntimeError occurred in "NodeXmlIO.py": not well-formed (invalid token)    Traceback (most recent call last):      File "Tabs/NodeGraphTab/NodegraphPanel.py", line 1428, in event      File "Tabs/NodeGraphTab/NodegraphPanel.py", line 1479, in __processUnfocusedKeyEvent      File "Tabs/NodeGraphTab/NodegraphPanel.py", line 913, in __copy      File "NodeXmlIO.py", line 210, in BuildNodesXmlIO      File "NodeXmlIO.py", line 794, in _SaveNodeXmlIO    RuntimeError: not well-formed (invalid token)
 
Workaround
Avoid using invalid characters when using nameRegExFind and nameRegExReplace.
 
Reproduced by support
This bug has been reproduced in:
Katana 5.0v2 - Windows 11
Katana 5.0v1 - Windows 11
Katana 4.5v2 - Windows 11
Katana 4.5v1 - Windows 11
Katana 4.0v8 - Windows 11
Katana 4.0v1 - Windows 11
Katana 3.6v1 - Windows 11
Katana 3.5v1 - Windows 11
Katana 3.2v1 - Windows 11
Katana 3.1v1 - Windows 11
 
Earliest version tested
Katana 3.1v1 - This issue appears to be in all versions of the product
 

    We're sorry to hear that

    Please tell us why