After Update to new Create version: module 'omni.kit.viewport' has no attribute 'get_default_viewport_window'

Hello,

I’ve updated to the newest version of Create, but now my extension runs on an error. I use get_default_viewport_window to get the vieport windows and capture it. But now this method is not found anymore. Can anyone help?

And can someone tell me where to find a docu about the python capabilities from the included extensions?

Thanks

Carl

Hi @c.bickmeier

It seems to be the method was moved to omni.kit.viewport_legacy
The problem can be solve with something similar to the next snippet:

try:
    viewport_interface = omni.kit.viewport.get_viewport_interface()
except Exception as e:
    print("omni.kit.viewport.get_viewport_interface:", e)
    print("Using legacy omni.kit.viewport_legacy.get_viewport_interface")
    viewport_interface = omni.kit.viewport_legacy.get_viewport_interface()

or in your case

viewport_window = omni.kit.viewport_legacy.get_default_viewport_window()

thank you very much, that helped

Thanks @toni.sm. I will also mention that with the next Kit release, it’ll also be good to refactor to using omni.kit.viewport.utility. This will prep you for when Viewport-Next is released.

Thank you very much for your reply, but waht do you mean with omni.kit.viewport.utility?

In general I have not yet understood where to find the docs for all those kit modules…

That extension is not released yet. When released, we’ll have viewport and omni.ui.scene samples that will make the usage clear.

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