Autodesk / Autodesk/maya-usd

Returning nullptr from Ufe::CameraHandler::camera crashes Maya

Open
#4,133 2 comments 0 reactions 1 assignee Claimed by @santosg87 View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

**Describe the bug**
According to the UFE 4.2 documentation for Ufe::CameraHandler::camera

**Returns**
**Camera** interface of given **SceneItem**. Returns a null pointer if no **Camera** interface can be created for the item.

However it appears that returning nullptr from a CameraHandler will crash Maya, starting with 2024/UFE4.

We were able to work around this issue by instead putting a conditional in the `find` functions for cameras we did not want to appear in the `Panels > Perspective` menu. This seemed to do the trick and avoid the crash. So, we are not blocked on this issue, but I wanted to file it and suggest that either returning `nullptr` from `camera` should be handled gracefully in UFE, or that the documentation (and the [current](https://github.com/Autodesk/maya-usd/blob/d109b9da9576acab000db291bb01ac941a82a789/lib/mayaUsd/ufe/ProxyShapeCameraHandler.cpp#L59) [code](https://github.com/Autodesk/maya-usd/blob/d109b9da9576acab000db291bb01ac941a82a789/lib/usdUfe/ufe/UsdCameraHandler.cpp#L55)) should be updated

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.