Omni.tetris - omni.kit has no attribute 'viewport_legacy'

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:
works, but then
AttributeError: ‘ViewportWindow’ object has no attribute ‘set_active_camera’

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:

and here:

But it does not give much information about the resulting class and its functions.

Hi @moebelhaus. Looks like that extension needs to be updated. I’ll created an issue for it.

You’re on the right track. Here’s an example of how to change the active camera: Change the Viewport’s Active Camera — Omniverse Kit documentation

I’ve created this issue for it: OM-74535

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

Thanks @rzulak! @moebelhaus I should also ask, where are you getting omni.tetris from? Which app and version?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.