Skip to content
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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

samuelliu-adsk
Copy link
Collaborator

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

@@ -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>()
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-1910/camera_visibility branch from 50f2dce to 3c15403 Compare February 13, 2025 03:25
@samuelliu-adsk samuelliu-adsk marked this pull request as ready for review February 13, 2025 03:26
@samuelliu-adsk samuelliu-adsk self-assigned this Feb 13, 2025
@samuelliu-adsk samuelliu-adsk added the workflows Related to in-context workflows label Feb 13, 2025

// 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>()
Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator

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?

Copy link
Collaborator

@deboisj deboisj Feb 13, 2025

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

Copy link
Collaborator

@deboisj deboisj Feb 13, 2025

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

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-1910/camera_visibility branch from 0150273 to 091798c Compare February 13, 2025 16:03
@@ -15,6 +15,8 @@
//
#include "UsdObject3d.h"

#include "pxr/usd/usdGeom/camera.h"
Copy link
Collaborator

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants