Operating System:
Windows
Kit Version:
106.4
Kit Template:
USD Composer
GPU Hardware:
40 series
GPU Driver:
Latest
Main Issue: How to Disable or enable gizmos in viewport through code
Error Code:
Operating System:
Windows
Kit Version:
106.4
Kit Template:
USD Composer
GPU Hardware:
40 series
GPU Driver:
Latest
Main Issue: How to Disable or enable gizmos in viewport through code
Error Code:
Hi there and thanks for your question. You wish to know How to Disable or enable gizmos in viewport through code?
What specific gizmos are you referring to? The actual manipulator for move, rotate, scale? We also have UI overlays for things like Cameras, Lights, grid, waypoints etc.
Hi @Richard3D Thanks for the response. I wanted to disable UI overlays like camera , Lights etc. in Viewport view through code.
@msaivikaskumar from some other research the easiest way to find commands is to enable the HOTKEYS WINDOW tool omni.kit.hotkeys.window
using this you can search toggle
to see all the toggle commands and hover to find the command/action being called.
omni.kit.viewport.actions
and the action is toggle_grid_visiblity
. Since this is an action we can use omni.kit.actions.core
to get and call the action. Try below in the Omniverse Script Editor
import omni.kit.actions.core
action_registry = omni.kit.actions.core.get_action_registry()
action = action_registry.get_action("omni.kit.viewport.actions","toggle_grid_visibility")
action.execute()
Read more in the following Documentation links:
omni.kit.viewport.actions Overview/Action List
omni.kit.viewport.actions Usage Examples
omni.kit.actions.core Python Usage Examples
NOTE: This is tested with the latest Production Branch (106.5.3)
Hope this helps,
-Eric
Here is the direct code:
viewport.show.camera = false
viewport.show.lights = false
viewport.show.audio = false
viewport.grid.enabled = false
viewport.outline.enabled = true
Hi @Richard3D
I getting following issue**[AttributeError: ‘ViewportWindow’ object has no attribute ‘show’]** when i am using this code “viewport.show.camera = false”
from omni.kit.viewport.utility import get_active_viewport_window
viewport = get_active_viewport_window()
is it same viewport you mentioned
viewport.show.camera = false
iam using kit 106.4 version. Thanks
Make sure you load
“omni.kit.viewport.actions” = {}
“omni.kit.viewport.utility” = {}
“omni.kit.viewport.window” = {}
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.