Save/Load materials not working?

Issue #1607 resolved
Paul created an issue

I’m trying to use the save/load materials options under Advanced->Materials but seem to be having an issue with loading them.

I’m getting the following error:

ERROR (1.7.0.1540):
JSON error while reading ascii file
"E:\Figure test\G8 mats.json"
Expecting value: line 91 column 38 (char 8142)
For details see
'C:\Users\terah\Documents\daz_importer_errors.txt'

Using a default G8F and default textures.

Blender 3.5 with add-on version 1.7.0.

I’ve tried importing with both Principled and BSDF materials as well as with different skin textures and get the same error (in a different line and column location but I’m assuming that’s down to differences in the shaders). It could be (probably is) that I’m missing something obvious. Steps I’m taking:

Load G8F base in Daz, save duf, then save dbz.

In Blender, Easy import of saved duf, expand Advanced settings, select G8 mesh in outliner and Save Materials.

Keeping G8 mesh selected, click Load Materials.

Error is then generated and no materials are replaced/loaded.

I’ve attached the exported JSON file below.

Comments (5)

  1. Alessandro Padovani

    daz studio 4.21.0.5, blender 3.5.1, diffeomorphic 1.7.1.1649, windows 10

    Following your exact steps works fine here, I get no errors. You may want to upgrade to 1.7.1 there’s many bug fixes now.

    p.s. Unless you’re on mac/linux that may have separate issues.

  2. Thomas Larsson repo owner

    The error seems to happen because the json file contains lines of the type

    "node_preview" : <bpy_struct, NodePreviewNodeProps("") at 0x000002AD9A1DB108>,
    

    which is illegal syntax. The plugin ignores certain attributes when saving materials. The quick fix in the last commit adds “node_preview” to this list. Thus Save/Load materials should work now. Since the fix is on the saving side, you must resave the json file first.

    There should be a more general solution to this type of problem. The general code that saves json files should detect if it tries to create illegal syntax, and skip that part. However, I could not reproduce the error, probably because I’m using Blender 3.5.0.

  3. Log in to comment