Making Asset Search Folders Work

Started by ares2101, June 07, 2021, 02:15:01 PM

Previous topic - Next topic

ares2101

I've lately been reminded of something I never quite got to work in Terragen over the years; being able to open a project on a different machine than the one I made it on and not get a bunch of errors.  I know the asset search folder feature exists, but it doesn't seem to work.  To test this, I made an asset search folder of the folder I store my World Machine .ter files and opened up a project I used one in.  In the heightfield node, it has an absolute path filename.  The asset search folder did not find the terrain file despite being pointed at the specific folder it was in.

What I am not getting here?  The documentation page seem to clarify this.

digitalguru

is this Windows? Can you post the text of the path you're using?

WAS

I wouldn't expect TG cataloging paths on one machine would work on another machine. Especially if it's based in users file space. I think this is exactly why we have the "gather project" function, to ship it to other machines or farms.

ares2101

Quote from: WAS on June 07, 2021, 02:55:36 PMI wouldn't expect TG cataloging paths on one machine would work on another machine. Especially if it's based in users file space. I think this is exactly why we have the "gather project" function, to ship it to other machines or farms.
The gather project has been my workaround to this, but it's kind of annoying to always have to do this.  The way asset search folder is described, it sounds like it's meant to negate the need for this.  I interpreted the description to mean it functions like "Hmm, not seeing that terrain file, oh lemme check this other folder for a file with that name...found it".  Is that now what this means?


Quoteis this Windows? Can you post the text of the path you're using?

I keep all the relevant files in a cloud sync folder.  Currently using Terragen within a Windows virtual machine.  Much of the relevant files are contained along these lines.

Sync Folder->Terragen 4 Projects->Various sub-folders containing my TGD files
Sync Folder ->Artwork Assets->Terragen->Plant TGOs->Various sub-folders containing TGO files for plants
Sync Folder ->Artwork Assets->Terragen->Various other sub-folders of pre-set files
Sync Folder->Artwork Assets->World Machine->Terrain Files

Now, going forward, I could just be careful to keep the file scheme the same across computers. The sync folder is accessed in the VM via a shared folder that's interpreted by Windows as the Z:/ drive, but all my old stuff was not made in this scheme and I would like to avoid having to manually fix a project every time I decide to open it up again for remembering how I did something, re-rendering it, or doing a derivative project.

digitalguru

I think I see your issue, and while I don't work on a virtual machine (which might introduce some complication I'm not aware of).

I believe your assets folder need to be in the same folder as the project file for relative paths to work. If you load a file outside of your project file folder it's just an absolute path and therefore can be broken.

It is a bit limiting in your case where you want to have a library to search in, but I think it's mainly designed to package up all the assets in one scene to send to a render service for instance.

If you create a folder structure in your project directory you can separate all your assets by type/folder and pick that up and have it work anywhere else you copy it to so long as you use relative paths

ares2101

Quote from: digitalguru on June 07, 2021, 03:49:07 PMI think I see your issue, and while I don't work on a virtual machine (which might introduce some complication I'm not aware of).

I believe your assets folder need to be in the same folder as the project file for relative paths to work. If you load a file outside of your project file folder it's just an absolute path and therefore can be broken.

It is a bit limiting in your case where you want to have a library to search in, but I think it's mainly designed to package up all the assets in one scene to send to a render service for instance.

If you create a folder structure in your project directory you can separate all your assets by type/folder and pick that up and have it work anywhere else you copy it to so long as you use relative paths

OK, still not sure why asset search doesn't seem to do what its description says, but I see what the absolute vs relative path thing does, though I don't want to organize things that way.  Guess I can just stick to a consistent file system on different machines from now on and just fix old stuff manually.

WAS

Actually I see your issue.

When you save a TGD, and if your assets are in the same directory, or subdirectories, it will use relative paths to those assets. Thus, on another machine with the same structure, it's possible for this saved TGD to still work.

But I think your issue is how you have things set up.

Quote from: undefinedSync Folder->Terragen 4 Projects->Various sub-folders containing my TGD files
Sync Folder ->Artwork Assets->Terragen->Plant TGOs->Various sub-folders containing TGO files for plants
Sync Folder ->Artwork Assets->Terragen->Various other sub-folders of pre-set files
Sync Folder->Artwork Assets->World Machine->Terrain Files

This would break any relative pathing. This is because Artwork Assets is outside Terragen 4 Projects, and inside the base root of the Sync Folder. Try something like


Quote from: undefinedSync Folder->Terragen 4 Projects->Various sub-folders containing my TGD files
Sync Folder ->Terragen 4 Projects->Artwork Assets->Terragen->Plant TGOs->Various sub-folders containing TGO files for plants
Sync Folder ->Terragen 4 Projects->Artwork Assets->Terragen->Various other sub-folders of pre-set files
Sync Folder->Terragen 4 Projects->Artwork Assets->World Machine->Terrain Files


Now when you load all those resources from those sub folders, or the base folder Terragen 4 Projects and save the project, it will use relative paths from Terragen 4 Projects downwards. That being said, on any other system using this same file structure it should work. So if Artwork Assets is in the projects folder, then it can use relative paths to those assets... that is, those relative paths actually point to the same thing.

Dune

This links to my concern that if I were to get a new machine, I'm virtually obliged to use the same partition/directory/folder structure, or all my old files will not find their assets. Especially partition I would like to change, but well...
For a few assets it's not a big deal to copy/paste a new line into the object's path, but if it's a hundred... :(

digitalguru

Quote from: Dune on June 08, 2021, 01:40:29 AMFor a few assets it's not a big deal to copy/paste a new line into the object's path, but if it's a hundred...
If these are .tgd files that need amending, there's a very handy windows program called fnr (http://findandreplace.io/) which can batch find and replace any changed paths in all your .tgd files in one go.

I've now moved to creating a template directory structure for Terragen projects which includes a \project_assets\ directory from the start (and subfolders for terrains, maps etc)
Everything gets saved to that and hence all the paths are then relative, if I want a plant from a library somewhere, I'll localise it to the \project_assets\plants\ directory.
The whole project is then pre-gathered and I can send it to a render service or move it anywhere.

Dune

Thanks a lot, handy to know!