Show/Hide toggle for multi-selected Prims does not work.
Omniverse Create 2021.3.2
When I specified Show/Hide (inherited/invisible) for multiple prims in the Stage window and toggled this state in Script, it did not work properly.
The following is a script that reverses the Visibility state of the selected Prims.
from pxr import Usd, UsdGeom, UsdPhysics, UsdShade, Sdf, Gf, Tf
# Get stage.
stage = omni.usd.get_context().get_stage()
# Get selection.
selection = omni.usd.get_context().get_selection()
paths = selection.get_selected_prim_paths()
# Toggle show/hide.
for path in paths:
# Get prim.
prim = stage.GetPrimAtPath(path)
if prim.IsValid() == False:
continue
# Get visibility.
primImageable = UsdGeom.Imageable(prim)
if primImageable.GetVisibilityAttr().Get() == 'inherited':
# Set hide.
primImageable.GetVisibilityAttr().Set('invisible')
else:
# Set show (inherited).
primImageable.GetVisibilityAttr().Set('inherited')
The result is as follows.
Visibility is not inverted.
This example shows the placement of four Prims.
I specified inherited/invisible/inherited/invisible and selected these four Prims to run the script.
Then, everything was selected.
However, I got similar behavior when switching Visibility without using scripts.
Currently, I am not sure if this problem is due to the UI or the USD SDK.

