Problem summary The filenameFilter callback and the Path Substitutions Preferences do not work as expected. On Windows and macOS, this issue has been reproduced with Read node paths and the custom OCIO config path. On Linux, this issue does not seem to occur with Read nodes.
Customer reported version Nuke 16.0v7
Customer reported platform Rocky 9
Steps to reproduce
1) Open Nuke.
2) Create a Read node.
3) Set its file knob to a path/file that doesn't exist. For example: C:/fake/AwesomePicture.jpeg
4) Save and close the script.
5) Run the following code in the Script Editor. This should resolve the Read node's file path to C:/temp/AwesomePicture.jpeg so this file should exist on your system:
However, the Read node will still be in an error state.
Steps to reproduce - Path Substitutions
1) Open Nuke.
2) Create a Read node.
3) Set its file knob to a path/file that doesn't exist. For example: C:/fake/AwesomePicture.jpeg
4) Save and close the script.
5) In Edit > Preferences > General > Path Substitutions, set the path for your current OS to a real path and the path on another OS to the path on your Read node. In this case, this should resolve the Read node's file path to C:/temp/AwesomePicture.jpeg on Windows. This file will need to exist on your system:
6) Close and reopen Nuke, to ensure the Preferences take affect.
7) Reopen the script.
Steps to reproduce - OCIO config path
1) Open Nuke.
2) In Project Settings (Edit > Project Settings) and set the following:
color management to OCIO
OCIO config to custom
custom OCIO config to the path of one of your config files (ie. /fake/<username>/Documents/ocio/config.ocio)
3) Save and close the script.
4) Run the following code in the Script Editor. This should resolve the custom OCIO config path to /home/<username>/Documents/ocio/config.ocio so this file should exist on your system:
Expected behavior The filenameFilter callback and Path Substitution Preferences should update the Read node and custom OCIO config file paths.
Actual behavior The filenameFilter callback and Path Substitution Preferences do not work. The Read node is in an error state (Windows only) and there are OCIO errors, when reopening the script.
Workaround Instead of relying on the path substitutions preferences, it should be possible to avoid these issues by explicitly updating the value of the Root's customOCIOConfigPath knob and or Read node's file knob, like with the following onScriptLoad and onCreate callbacks: