Sunday, August 9, 2020

Automatic Root Path Extraction

 Unlike OBJ or FBX files, a file from DAZ Studio (.duf, .dsf) is not self-contained. Instead it contains pointers to other DAZ files, which may contain further pointers or the actual data. The pointers are given relative to the DAZ Studio root directories, which are listed at the top of the Content Library tab in DAZ Studio.


In Blender we find the root paths in the Global Settings dialog, which we open by pressing the Global Settings button just below the Import DAZ File button in the Setup panel.


The default root paths listed in Blender may work in Windows if you have installed DAZ Studio with the default settings. However, if you use non-standard locations for your assets, or access assets over the web, or use a Mac, these settings will not be right. 

It is absolutely mandatory that you have the same root paths as in DAZ Studio, because otherwise the Blender plug-in will not find your assets at all. The time-honored method to fix this has been to type in the root paths by hand. However, this is rather cumbersome, even if you only have to do it once if you save the settings afterwords. The manual method still works, but in the development version there is a more convenient way to do it.


In the to_daz_studio folder there is a new subfolder called Scripts. Copy or link this folder to one of you DAZ Studio base directories and start up DAZ Studio.


In the Content Library tab, the Scripts folder contains a new subfolder called Diffeomorphic, which contains a single DAZ script called save_root_paths. (Further scripts will be added later). Double-click on the save_root_paths icon.


The scripts starts and asks for a location where to save the file. Specify the location and press Save.

A message box informs us that the root paths have been saved.

Back in Blender, open the Global Settings dialog again, and press Load Root Paths.


Select the file that you saved in DAZ Studio, and press Load Root Paths

The root paths in Blender are now the same as in DAZ Studio.

Actually, if you compare with the first illustration, there is an additional directory for shaders. This is an MDL directory, which is necessary to find some textures, e.g. the DTHDR-RuinsB-500.hdr environment map.