Autodesk / Autodesk/maya-usd

[EMSUSD-2669] mayaUsd_exportHelpers.py: listRelatives should use the fullPath flag

Open
#4,264 1 comment 2 reactions 1 assignee Assigned to @santosd View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 5h
Merged PRs (30d)
16

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.