Skip to content

[BUG] No src attribute on material.interface child #31

@skarone

Description

@skarone

When trying to write with the UsdMaterialBake node, I get this error:

[INFO python.LookFileBakeAPI.LookFileBaker]: Writing pass 'default'
Traceback (most recent call last):
  File "LookFileBaker.py", line 649, in bake
  File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/plugin/Plugins/usdExport.py", line 508, in writeSinglePass
    writePassData(stage, rootPrimName)
  File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/plugin/Plugins/usdExport.py", line 412, in writePassData
    materialDict)
  File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/plugin/Plugins/usdExport.py", line 275, in writeMaterialAttribute
    WriteMaterial(stage, sdfLocationPath, materialAttribute)
  File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/lib/python/UsdExport/material.py", line 177, in WriteMaterial
    AddMaterialInterfaces(stage, parameters, interfaces, material)
  File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/lib/python/UsdExport/material.py", line 676, in AddMaterialInterfaces
    sourceAttr.getValue()).split(".")
AttributeError: 'NoneType' object has no attribute 'getValue'
[ERROR python.root]: A LookFileBakeException occurred in "LookFileBaker.py": Error writing UsdExport look file: 'NoneType' object has no attribute 'getValue'
    Traceback (most recent call last):
      File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/plugin/SuperTools/UsdMaterialBake/Editor.py", line 100, in <lambda>
        lambda checked : self.__groupNode.bake(parentWidget=self))
      File "/net/pipeline/katana/plugins/KatanaUSD/build/4.5v2/plugin/SuperTools/UsdMaterialBake/Node.py", line 280, in bake
        referenceOp, passNamesAndOps, rootLocations, assetId)
      File "LookFileBaker.py", line 347, in bakeAndPublish
      File "LookFileBaker.py", line 656, in bake
    LookFileBakeException: Error writing UsdExport look file: 'NoneType' object has no attribute 'getValue'

After running this snippet, I found which child attributes have no src attribute:

attr = UI4.FormMaster.AttributeShare.material_interface
no_scr_attrs = []
for interfaceIndex in xrange(attr.getNumberOfChildren()):
    interfaceName = attr.getChildName(interfaceIndex)
    interfaceAttr = attr.getChildByIndex(interfaceIndex)
    hintsAttr = interfaceAttr.getChildByName("hints")
    groupName = None
    if hintsAttr:
        pageAttr = hintsAttr.getChildByName("page")
        if pageAttr:
            groupName = pageAttr.getValue()
    try:
        sourceAttr = interfaceAttr.getChildByName("src")
        sourceShaderName, sourceParamName = str(
        sourceAttr.getValue()).split(".")
    except:
        no_scr_attrs.append(interfaceName)
print no_scr_attrs
['PSSpecularOutputMax', 'PSRefractionIndex', 'PSExtinctionCoefficient', 'PSExtinctionCoefficientOutputMax', 'PSExtinctionCoefficientAtlasStyle', 'PSExtinctionCoefficientColor', 'PSRoughnessExposure', 'CCFaceColor', 'CCFaceColorAtlasStyle', 'CCFaceColorColor', 'CCFresnelExponent', 'SGIrradianceRoughnessColor', 'DLDisplacementType', 'GBPresenceColor', 'AOV3Color', 'AOV3ColorAtlasStyle', 'AOV3ColorColor', 'AOV4Color', 'AOV4ColorAtlasStyle', 'AOV4ColorColor', 'AOV5Color', 'AOV5ColorAtlasStyle', 'AOV5ColorColor', 'AOV6Color', 'AOV6ColorAtlasStyle', 'AOV6ColorColor', 'AOV7Color', 'AOV7ColorAtlasStyle', 'AOV7ColorColor']

Not sure if there are nodes that are not supported, and that's causing the problem.

Any feedback would be much appreciated.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions