New external drive Tg4 cant locate project material

Started by james adamson, March 11, 2024, 11:49:34 AM

Previous topic - Next topic

james adamson

Is there a quick way to search an locate image maps etc as the file path has changed?

Kevin Kipper

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.

james adamson

Hi. Thanks for your response.
Unfortunately I dont know Python and the project file is massive.
Any other ideas?
Thanks.
James.

Kevin Kipper



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.

james adamson

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

james adamson


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?

Matt

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?
Just because milk is white doesn't mean that clouds are made of milk.

Kevin Kipper

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.

Matt

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.
Just because milk is white doesn't mean that clouds are made of milk.

Kevin Kipper

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.

Dune

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.

james adamson

Thanks all.
Appreciate the help jumping back on it now.

james adamson


james adamson

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.

james adamson

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.