Sidor

Tuesday, October 18, 2022

Preferred Root Directory

Recently I have rearranged my DAZ Studio database. I used to put all assets in the same base directory, but that made DAZ Studio very sluggish as the size of the database grew. The reason seems to be that DAZ Studio scans the entire database before opening a new file, which can take a very long time when the database is large. To improve performance I split the DAZ database into many small pieces, and only enable the base directories that I need for a given project.This makes DAZ Studio react much quicker.

Here are my active base directories.

 

Then I save a json file with the root paths that are relevant for this particular project, using the Save Root Paths entry in the File menu. The same script can also be found in the Scripts folder.
After using the Load Root Paths button in the global settings dialog, we have the same root paths in Blender

However, what is somewhat inconvenient with many root paths is that some file selectors open up in the wrong directory. Here we have imported a character with a geometry shell, but for some reason the shell UVs were not imported. This happens sometimes, if the name of the UV set differs from the name of the file where it is defined. In that case the corresponding UV Map node signals an error by becoming red.
To fix this we use the Load UV Set tool in the Advanced Setup > Materials section. The file selector starts in the directory where is expects to find UV sets. However, the problem is that in this case it starts in the wrong directory. The file selector starts in a subdirectory of  C:\Users\Public\Documents\My DAZ 3D Library, which is the first root path. But in our case we know that the geometry shell is located under D:\DAZ 3D\Daz groups\Female\Outfit. We can of course navigate to the right directory, but that is quite a nuisance because it involves many mouse clicks.
The new way to make the file selector open in the right directory is to set the Preferred Root Directory. This is an drop-down menu located in the Setup menu, right below the Global Settings button. Simply select the right root directory from the drop-down list.
When we now invoke the Load UVs button, it opens up in the right directory.

And the desired DAZ file with the UVs is just a few mouse clicks away.
The new UV map is loaded and the UV Map node turns black, indicating that everything is fine. We now see why the add-on did not find the shell UVs: the name of the UV map contains an extra "A" at the end not present in the name of the file where it is defined.
The preferred root directory also works with other tools that start in a special directory, e.g. Import Custom Morphs.