-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMSUSD-1910 - Make USD camera invisible when the parents turn invisible #4110
base: dev
Are you sure you want to change the base?
Conversation
samuelliu-adsk
commented
Feb 7, 2025
- This change is the Maya-usd side of the story.
- Currently if the user hide the parent of a camera or the entire stage node, the camera gizmo will still show up in the viewport.
- Adding the visibility function to camera because the original visibility function in UsdObject3d will be used to determine the outliner row visibility as well. If we return false in that function, the outliner will hide the camera as well, which does not align with the behavior of other prim types.
lib/usdUfe/ufe/UsdObject3d.cpp
Outdated
@@ -108,6 +110,23 @@ bool UsdObject3d::visibility() const | |||
auto visAttr = PXR_NS::UsdGeomImageable(_prim).GetVisibilityAttr(); | |||
visAttr.Get(&visibilityToken); | |||
|
|||
// Check if the prim is a camera | |||
// if its a camera, then we need to check if the camera's parents are visible | |||
if (_prim.IsA<PXR_NS::UsdGeomCamera>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break the UFE explorer we have in 3dsmax : https://git.autodesk.com/brossee/3dsmax-component-usd-public/blob/4718c8ae447cea4ed005d3642cd6dcfd37c54682/src/UFEUI/standardTreeColumns.cpp#L203
We need visibility() to return the authored attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue should be addressed by my new changes. Basically I moved the change to MayaUsdObject3d instead of object3d.
50f2dce
to
3c15403
Compare
|
||
// Check if the prim is a camera | ||
// if its a camera, then we need to check if the camera's parents are visible | ||
if (prim().IsA<PXR_NS::UsdGeomCamera>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will not break 3dsmax, but i still find it a bit iffy that now the behavior varies per object type. Makes the API inconsistant / contract unclear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also awkward because now setVisiblity and getVisibility will not be symmetrical, you will set the authored attr but return the resolved visibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deboisj Do you have another suggestion on how we can accomplish this task to hide cameras in the 3d viewport when they are hidden because their parent is hidden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure - how do you handle this for lights? Isnt it the same problem? In max - we have a mechanism to get the resolved visibility and maintain / update a cache for that - but i guess in your case that would have to be done in maya which sounds impractical Could you "hide" it by giving it no gizmo / render item? Do you control anything VS how the camera gizmo is displayed? If maya thought it was visible, but in the end nothing displays, that's probably closest to how the rest of things work in maya-usd - because everything else currently reports "visible' and may actually be "invisible", i.e. in the outliner it would not be color coded insivible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually said something wrong above, the setter calls "make invisible/visible". So there is already a level of asymmetry with the getter
0150273
to
091798c
Compare
@@ -15,6 +15,8 @@ | |||
// | |||
#include "UsdObject3d.h" | |||
|
|||
#include "pxr/usd/usdGeom/camera.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
@@ -52,5 +54,33 @@ MayaUsdObject3d::adjustAlignedBBox(const Ufe::BBox3d& bbox, const PXR_NS::UsdTim | |||
return UsdUfe::combineUfeBBox(bbox, pulledBBox); | |||
} | |||
|
|||
#ifndef UFE_CAMERA_HAS_VISIBILITY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put a comment here stating that when the camera has the visibility method it will be used and this method is used in the older Maya case.