I’m currently trying to get a separate viewport up and running in my extension, and I’ve set up the basic one described in the Omniverse Viewport Next tutorial that loads up with Code. I couldn’t find a link to the tutorial online, but it’s the one that looks like this:
Right now, I have an extension that creates an instance of the “StagePreviewWindow” class, which itself has an instance of the “StagePreviewWidget” class, as suggested in the code blocks provided. Essentially, all I’ve done is copy the tutorial code presented and resolve all the missing imports.
Right now I have a second viewport that I can manipulate mostly normally (scroll wheel doesn’t work for some reason; instead I have to press ALT + RMB), but I’m running into issues adding additional features.
- I’d like to add buttons on top of the viewport, but adding them to the widget’s Z-Stack doesn’t seem to be doing the trick. EDIT: Adding them to a ZStack attached to the Window (not the widget) seemed to work perfectly, so this one is solved.
- I’d like the resolution of the viewport to update with the window resizing, and for the scene view to remain centered in the display as in the standard viewport.
- Ideally I’d like to get scrolling to work as it does in the original viewport.
- Currently I have the extension set to auto-load, but the window doesn’t appear until I disable and re-enable the extension; ideally I’d like it to appear on start-up.
I apologize if these things have already been addressed in other forum posts; I did a quick search and couldn’t find anything relevant, but I may have missed something. Thanks!
EDIT: I wanted to add that I have tried to look through the standard Viewport extension, but because it pulls content from the legacy viewport, it is difficult to determine what exactly it’s doing to achieve the functionality described above.