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

Prim visibility does not show visibility info #72

Open
cadop opened this issue Aug 16, 2024 · 4 comments
Open

Prim visibility does not show visibility info #72

cadop opened this issue Aug 16, 2024 · 4 comments

Comments

@cadop
Copy link
Contributor

cadop commented Aug 16, 2024

This example:

assert get_visibility_attribute(stage, cube_path).Get() == "inherited"
hide_prim(stage, cube_path)
assert get_visibility_attribute(stage, cube_path).Get() == "invisible"
show_prim(stage, cube_path)
assert get_visibility_attribute(stage, cube_path).Get() == "inherited"

Shows the prims attribute of visible or inherited. Inherited does not mean visible, but invisible means invisible. This is unclear. There should at least be some method showing how to check its actual visibility (based on what it inherits).

@mati-nvidia
Copy link
Contributor

I'm jumping back on this repo soon.

I think we probably want an additional sample around the idea of "Get the visibility state of a prim" that shows the use of ComputeVisibility

@cadop
Copy link
Contributor Author

cadop commented Aug 16, 2024

Interesting,

This function should be considered a reference implementation for correctness. 
If called on each prim in the context of a traversal we will perform massive overcomputation, 
because sibling prims share sub-problems in the query that can be efficiently cached, 
but are not (cannot be) by this simple implementation.
 If you have control of your traversal, it will be far more efficient to manage visibility 
on a stack as you traverse.

So should an example be using this method, or doing the traversal

@mati-nvidia
Copy link
Contributor

I think for most cases, I would start with this function and optimize when needed. It doesn't make sense to deal with the logic of traversal and caching if you're maybe just checking a few targeted prims.

@cadop
Copy link
Contributor Author

cadop commented Aug 16, 2024

For future PR reference:

Annoying syntax, instead of just having it as an attribute, create an Imageable, then compute it. It's not true/false, so then check against the token.

#Check if prim is visible in the scene or not
if UsdGeom.Imageable(x).ComputeVisibility() == UsdGeom.Tokens.invisible:
    print('Invisible')  

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

No branches or pull requests

2 participants