Easy import ignores material method selection; always uses BSDF

Issue #929 resolved
Luke Graybill created an issue

I’m still fairly new to blender scripting, so apologies if I’m missing something here with how an operator is supposed to be called from a script. However, it seems that regardless of what I specify when calling bpy.ops.daz.easy_import_daz using the materialMethod keyword, the materials actually loaded are always BSDF materials.

The keyword does not appear to be listed in the docs for this operator at https://diffeomorphic.blogspot.com/p/daz-importer-operators-version-16.html, but the method hint from the python console within Blender shows it:

>>> bpy.ops.daz.easy_import_daz(
easy_import_daz()
bpy.ops.daz.easy_import_daz(filepath="", files=[], directory="", filter_glob="*.duf;*.dsf;*.png;*.jpeg;*.jpg;*.bmp", onMorphSuffix='NONE', morphSuffix="", units=False, expressions=False, visemes=False, facs=False, facsexpr=False, body=False, useMhxOnly=False, jcms=False, flexions=False, useCreateDuplicates=True, useMergeNonConforming=False, fitMeshes='DBZFILE', morphStrength=1, skinColor=(0.6, 0.4, 0.25, 1), clothesColor=(0.09, 0.01, 0.015, 1), materialMethod='BSDF', rigType='DAZ', mannequinType='NONE', useEliminateEmpties=True, useMergeRigs=True, useMergeMaterials=True, useMergeToes=False, useTransferShapes=True, useSoftbody=False, useMergeGeografts=False, useMergeUvs=False, useMergeFaceMeshes=False, useLashes=True, useTear=False, useBrows=False, useBeard=False, useConvertWidgets=False, useMakeAllBonesPoseable=True, useFavoMorphs=False, favoPath="", useAdjusters=False, useConvertHair=False, addTweakBones=True, useFingerIk=False)
Load a native DAZ file and perform the most common operations

Through poking around and trial and error, I managed to find out that the acceptable options for the keyword are 'BSDF' (the default), 'PRINCIPLED', and 'SINGLE'. However, whichever of the other options I specify for the keyword, the materials produced are always the BSDF variety.

The material method selection in the easy import dialog does seem to work fine, however, producing principled materials as expected - it is only when calling the operator myself from a script that the keyword value seems to be ignored.

Edit: Oops, the material method seems to be ignored entirely by the easy import operator, whether it is called via UI or not. I’ve updated the issue title to reflect that.

Comments (5)

  1. Luke Graybill reporter

    After further experimentation, it seems I was wrong above: the easy import dialog is also apparently ignoring the material method selection. I am only able to obtain principled materials by using the regular (non-easy) import operator:

    bpy.ops.daz.import_daz(
        materialMethod='PRINCIPLED',
    )
    

    This call works as expected, producing principled materials like so:

    However, the equivalent easy_import_daz operator call:

    bpy.ops.daz.easy_import_daz(
        materialMethod='PRINCIPLED',
    )
    

    produces a BSDF material instead:

    Note that I am using Blender 3.1 stable and addon build 1.6.1.0920 to reproduce this behavior.

  2. Luke Graybill reporter

    Here is a blendfile with a minimal script illustrating the bug.

    Script is just this:

    import bpy
    import import_daz
    
    
    import_daz.clear_selection()
    import_daz.set_selection([bpy.path.abspath('//g8f.duf')])
    bpy.ops.daz.easy_import_daz(
        materialMethod='PRINCIPLED',
    )
    

  3. Log in to comment