Monday, July 2, 2018

Stripped runtime system

In version 1.3 of the Daz importer the face bones drivers use Custom Driver Functions. This represents a major improvement compared to the methods used in earlier versions, because
  1. There no limit to the number of driving properties.
  2. Driver functions can be combined with other drivers.
  3. Performance is much better than with handlers.
However, there is a caveat. The add-on must always be enabled, because the drivers use the function evalMorph, which is defined by the add-on. This is not really a problem as long as you stay on the same computer, but if you send your blend file to another machine which does not have the Daz importer installed, the missing driver function will destroy the face pose completely. A typical situation where this problem may arise is if you send the blend files away to a render farm.

If you look in the DOS/terminal window, you find a lot of error messages of the form

Error in Driver: The following Python expression failed:
        'evalMorphs(self, 2, "Rot")'

Traceback (most recent call last):
  File "<bpy driver>", line 1, in <module>
NameError: name 'evalMorphs' is not defined

Thus clearly the problem is that the drivers for the face bones call the function evalMorphs, which is missing because it defined by the non-available import-daz add-on.

To solve this problem, the definition of evalMorphs and some necessary supporting code has been duplicated in the file, located in the folder with the same name under the import_daz directory. Since this addition is very recent, you need to download the latest development version of the add-on.

To use this file when the import-daz add-on is disabled, follow these steps:

In the Scripting context, select Open to open a text file.

Navigate to the file import-daz/runtime_stripped/

First enable the Register checkbox, and then press the Run Script button. Finally save the blend file.

Open the blend file again. Since it is the last file saved, it should be found at the top of the Open Recent... menu item.

And now the ugly face is replaced by a smile.

At least this works in this example. It is not clear to me if it will still work if you do batch rendering from a terminal, or if you have do some extra steps as well.