I'm having trouble using the filerename node. The rename field seems to be limited to a string expression, and I found it surprisingly difficult to find a way to express the rename that I want.
I have a terrain file called terrain_x0_y0.png, and I want to rename it to terrain_x0_y0_uint16.png.
How can I express this? Ideally, I'd like to use the string functions in python, because it's easy to do a string replace, or splitting, etc. I tried setting the node language to python and set a keyframe to force evaluating the string in python.
I couldn't even get the filename pdg attribute into the newpath parameter after trying all of these variations:
kwargs('filename')
workItem().environment
workItem().stringAttribute('filename')
workItem().envLookup('filename')
Finally, I tried this expression that seemed to do the trick, but it seemed especially awkward. Is this the best expected solution?
`@directory`/`substr(@filename, 0, strlen(@filename) - 4)`_uint16.png
PDG filerename problem
2328 3 1- scottp
- Member
- 26 posts
- Joined: Nov. 2008
- Offline
- BrookeA
- Staff
- 387 posts
- Joined: Aug. 2017
- Offline
- scottp
- Member
- 26 posts
- Joined: Nov. 2008
- Offline
Thank you for the nice example. My issue was that I didn't know how to evaluate a Python expression in a filename. I am inferring that you set a keyframe on the filename with Python as the expression language. Let me know if I'm wrong about that.
Scott Peterson, Machine Learning Graphics Engineer, Unity
- BrookeA
- Staff
- 387 posts
- Joined: Aug. 2017
- Offline
-
- Quick Links