ID 507274 - PyGeometryProducer.getAttributeNames() no longer provides names in alphanumerical order

Follow

Problem summary:

As of Katana 4.5v1 and 5.0v1, PyGeometryProducer.getAttributeNames() returns a Python Set, which is unordered, rather than an alphanumerically ordered List.

The arbitrary order this produces is, by default, consistent between Katana sessions in Katana 4.5 (Python 2), but not consistent between Katana sessions in Katana 5.0 (Python 3), according to whether or not Python's hash randomisation feature is enabled.

The order of names returned by PyGeometryProducer.getAttributeNames() is used, for example, in ordering top level attributes written by the AttrDump utility.

Steps to reproduce:

Execute the following in the Python tab:


opScriptNode = NodegraphAPI.CreateNode('OpScript', parent=NodegraphAPI.GetRootNode())
opScriptNode.getParameter('applyWhere').setValue('at all locations', 0)
attrNames = ('az', 'ay', 'ax', 'aw', 'av', 'au')
scriptText = '\n'.join(["Interface.SetAttr('{}', IntAttribute({}))".format(attrName, i)
                        for i, attrName in enumerate(attrNames)])
opScriptNode.getParameter('script.lua').setValue(scriptText, 0)
attributeNames = Nodes3DAPI.GetRenderProducer(opScriptNode).getAttributeNames()
print(attributeNames)

Expected behaviour:

attributeNames is a List with the following value: ['au', 'av', 'aw', 'ax', 'ay', 'az', 'renderSettings', 'type']

Actual behaviour:

attributeNames is a Set containing the correct values, but with no defined order.

Workaround:

No known workaround.

Tested versions/platforms:

  • 4.0v8 - Unaffected
  • 4.5v1 - Affected
  • 5.0v1 - Affected

    We're sorry to hear that

    Please tell us why