ID 352836 - Exporting a ScenegraphXML from Maya will not function if duplicate objects are detected.

Follow

Problem summary
When exporting multiple objects with the same name using the ScenegraphXML, the script will exit and throw the following exception:

----------
# Error: line 1: ValueError: file C:/Users/KATANA2/Documents/maya/2017/scripts\ScenegraphXML\maya2scenegraphXML.py line 570: More than one object matches name: cone1 #
----------

Customer reported version
Katana3.0v1

Customer reported platform
n_a_windows

Steps to reproduce

1) Download the attached MayaScenegraphXMLRepro.zip file

2) Setup the Maya plugin environment variable to the ScenegraphXML folder within the zip file.

2) Open the toMayaPrimitives.ma in Maya

3) Within Maya, edit the cylinder to be named 'cone1'

4) Within the Maya script editor, copy the toKatana.py script and execute it.

Result: You will receive the following exception:
----------
# Error: line 1: ValueError: file C:/Users/KATANA2/Documents/maya/2017/scripts\ScenegraphXML\maya2scenegraphXML.py line 570: More than one object matches name: cone1 #
----------

Workaround
Option 1: ( Temporary )
We found that the error More than one object matches name comes from the Maya function cmds.listAttr, which is complaining about an ambiguous instruction. 
The export works when you also specify the parent of the relevant objects in maya2scenegraphXML.setComponent.

As an example, for the Maya scene attached to the zip file provided, edit toKatana.py with the following:
maya2scenegraphXML.setComponent(['testScene|cone1', 'torus', 'ball', 'fourCones|cone1', 'cone2', 'cone3', 'cone4'], refType='abc')

Option 2: ( Permanent )
Re-wrie line of 366 in maya2scenegraphXML:

 relShapes = cmds.listelatives(curNodeName, shapes=True) 

  to

relShapes = cmds.listelatives(mayaElementPath, shapes=True) 


This will allow the use of multiple objects of the same name to be exported.

Reproduced by support
This bug has been reproduced in:
Katana3.0v1 - Windows 7
Katana2.6v4 - Windows 7

Using:
Maya 2016 - Windows 7
Maya 2018 - Windows 7

Expected behaviour
The export should allow multiple objects with the same name in different hierarchy's be exported.

Actual behaviour
The export is cancelled when a duplicate object is found.

    We're sorry to hear that

    Please tell us why