TheFoundryVisionmongers / KatanaUsdPlugins

Katana USD Plugins Repo
Other
47 stars 20 forks source link

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

Open skarone opened 1 year ago

skarone commented 1 year ago

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!