Trying to work through the awesome omni.tetris extension, the code is broken after functions have been moved from omni.kit.viewport to omni.kit.viewport_legacy as per this forum post:
When following this post, the module does not exist anymore?
viewport_window = omni.kit.viewport_legacy.get_default_viewport_window()
leads to error:
AttributeError: module ‘omni.kit’ has no attribute ‘viewport_legacy’
Using instead:
omni.kit.viewport.utility.get_active_viewport_window()
works, but then
AttributeError: ‘ViewportWindow’ object has no attribute ‘set_active_camera’
fails.
Assuming omni.kit.viewport.utility.get_active_viewport_window() is the way to go nowadays, I am trying to find out what class this function returns, and what class-function can then be used to “set the active camera” for the viewport object. I am digging around here:
@moebelhaus You should be using get_active_viewport() rather than get_active_viewport_window().
The former will return a Viewport object that the camera can be set to, the latter returns the omni.ui.Window the “active” Viewport is within.