Skip to content

mayaUsd_exportHelpers.py: listRelatives should use the fullPath flag #4264

Open
@clekin

Description

@clekin

Describe the bug
mayaUsd_exportHelpers.py causes an error message when two cameras have the same name

Steps to reproduce
// create a camera and group it
camera;
rename cam;
group -name backup;
// create a second camera with the same name
camera;
rename cam;
// export it to USD
mayaUSDExport -file "cam.usda" "|cam";
// notice the following error message
#Error: ValueError: file ...\mayausd\MayaUSD\plugin\adsk\scripts\mayaUsd_exportHelpers.py line 40: More than one object matches name: cam

Solution
Line 40 looks like this:

            if cmds.camera(cmds.listRelatives(c, parent=True)[0], startupCamera=True, q=True):

The problem is, that listRelatives only returns node names when used without the fullPath flag. But node names can be ambiguous.
To fix the issue, line 40 should be changed to:

            if cmds.camera(cmds.listRelatives(c, parent=True, fullPath=True)[0], startupCamera=True, q=True):

In mayaUsd_exportHelpers.py there are more calls to listRelatives, most of them without the fullPath flag. All of them have the risk of leading to ambiguity and should be changed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions