Is there a quick way to search an locate image maps etc as the file path has changed?
Hi James,
I'm not aware of a specific tool in Terragen to search and replace/update file paths for image maps loaded into a project.
I suspect that if the image maps existed in the Terragen Library, the library would also need to be refreshed, otherwise they would point to the older location.
One approach might be to write a Python script that would use the Terragen RPC feature to read through the image maps in the project, and replace existing paths with another path that you would specify. Another alternative would be to text edit the project file, replacing the old path with the new path via a copy/paste operation.
Hi. Thanks for your response.
Unfortunately I dont know Python and the project file is massive.
Any other ideas?
Thanks.
James.
Can you provide an example of how the file paths have changed? For example, were the image map file paths previously in the project/Project_Assets folder, or located randomly across the hard drives/network? I'm asking in order to get a better idea of the type of script you would need to address this type of issue.
Another idea might be to use the "Export Gathered Project" option. This will save all the contents to a folder you specify, including texture maps, and re-path them in the gathered project.
So the original all that has changed is the external drive name and two paths have been added in the string.
so it was. Volumes/LaCie/project_name/Shots/shot_name
The setup now is Volumes/LaCie RAID VD 0/JAMESADAMSONVFX/project/project_name/Shots/shot_name
The weird name for the external drive was automatically generated when I striped it into one drive.
Thanks again.
James
I don't seem to have the option to export gathered project but as non of the assets are loaded into the project how would this work?
Would i then move all the assets into a folder for the project?
If you can load the .tgd file into a text editor it should be possible to do a replace-all text replacement of the volume name with the new path. Is the file too big to do this?
I've written a quick python script which basically does the copy/paste that Matt suggested. It's limited to Image Map Shader nodes only. It's available for download on git-hub here: https://github.com/RedMawVFX/tg-replace-image-map-paths. I'll post this in the forum announcement rpc thread too.
Cool. Does this work if only part of the folder structure needs to change, e.g. just the drive (volume)? And what about other nodes besides image map shaders? I think it would be useful to have a node-agnostic string replacement.
Currently, the script requires the current directory path be replaced with the new directory path. Swapping out only the drive letter wouldn't work in this case. For example, if the old folder path and file was "C:myProject/Project_Assets/myTexture.jpg" and you only entered "E:" for the replacement string the new filename parameter would be set to "E:myTexture.jpg". Only image map shaders are supported in this script.
My 2 cents: I sometimes have missing files, then use project gather and check find files with problems. Then you can find whatever needs a different string. If I have located the file, I just copy part of that string (the part that's missing/different), and paste that into the wrong string (first selecting the part that needs to be replaced), thus kind of text-editing within TG. But it won't search for files, you'll have to locate them first.
Thanks all.
Appreciate the help jumping back on it now.
Is the RPC module already installed in 4.7?
Aaaand
Never used a Python script in. Terrragen. Where do place the .py and how do I get Terragen to register the new script?
In Nuke its a reasonably convoluted process for a non coding scripting bod.
So i have been looking at "Hello RPC! Part1".
And some commands are not behaving as expected which is either me? Or that i am on a Mac, and Python commands may be different on a Mac?
Or both?
The install RPC command seemed to work but the commands after that did not.
Hi James,
As long as you can access the .py scripts on your network, you're free to place them where ever you like. For example E:\Terrgen_Scripts\ and perhaps a subfolder for each script if they include documentation or supporting files other than the .py file.
Can you let us know what commands from the Hello RPC! Part1 are not working? The blog post was written for a Windows system, but I wouldn't think the Python commands would be different across operating systems.
There are differences for example I type python3 to run python. 3 being version