Planetside Software Forums

General => Terragen Discussion => Topic started by: james adamson on March 11, 2024, 11:49:34 AM

Title: New external drive Tg4 cant locate project material
Post by: james adamson on March 11, 2024, 11:49:34 AM
Is there a quick way to search an locate image maps etc as the file path has changed?
Title: Re: New external drive Tg4 cant locate project material
Post by: Kevin Kipper on March 11, 2024, 12:17:57 PM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 11, 2024, 12:42:42 PM
Hi. Thanks for your response.
Unfortunately I dont know Python and the project file is massive.
Any other ideas?
Thanks.
James.
Title: Re: New external drive Tg4 cant locate project material
Post by: Kevin Kipper on March 11, 2024, 01:48:49 PM


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.
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 11, 2024, 02:13:18 PM
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
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 11, 2024, 02:36:47 PM

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?
Title: Re: New external drive Tg4 cant locate project material
Post by: Matt on March 11, 2024, 04:23:23 PM
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?
Title: Re: New external drive Tg4 cant locate project material
Post by: Kevin Kipper on March 11, 2024, 05:09:30 PM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: Matt on March 11, 2024, 08:10:35 PM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: Kevin Kipper on March 11, 2024, 08:28:46 PM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: Dune on March 12, 2024, 02:37:19 AM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 13, 2024, 10:50:51 AM
Thanks all.
Appreciate the help jumping back on it now.
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 13, 2024, 11:15:05 AM
Is the RPC module already installed in 4.7?
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 13, 2024, 11:21:48 AM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 13, 2024, 12:31:51 PM
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.
Title: Re: New external drive Tg4 cant locate project material
Post by: Kevin Kipper on March 13, 2024, 02:56:31 PM
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.

Title: Re: New external drive Tg4 cant locate project material
Post by: james adamson on March 13, 2024, 06:39:04 PM
There are differences for example I type python3 to run python. 3 being version