I would create scene views using the following code snippet:
from omni.ui import scene as sc
from omni import ui
from pxr import Gf, Sdf, Usd, UsdGeom
from omni.kit.scene_view.xr_utils.ui_container import UiContainer
from omni.kit.scene_view.xr_utils.manipulator_components.widget_component import WidgetComponent
from omni.kit.scene_view.xr_utils.spatial_source import SpatialSource
class TestWidget(ui.Widget):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Frame container for this widget
self._root_widget = ui.ZStack()
self.build()
def build(self):
self._root_widget.clear()
with self._root_widget:
ui.Rectangle(style={
"background_color": ui.color("#292929"),
"border_color": ui.color(0.7),
"border_width": 2,
"border_radius": 4,
})
with ui.VStack(style={"margin": 8}):
with ui.VStack(style={"margin": 0}):
ui.Label("Hello, Omniverse!")
widget_component = WidgetComponent(
TestWidget,
width=400,
height=400,
resolution_scale=4.0,
unit_to_pixel_scale=2.0,
update_policy=sc.Widget.UpdatePolicy.ALWAYS,
construct_callback=None,
widget_kwargs={}
)
widget_container = UiContainer(
widget_component,
space_stack=[
SpatialSource.new_translation_source(Gf.Vec3d(0, 0, 0)),
SpatialSource.new_rotation_source(
Gf.Vec3d(90, 0, 0))
])
After Kit 108, it appears UiContainer now takes a omni.ui.scene.SceneView type instead of ui.Widget type (if I read it correctly). However, simply changing TestWidget to inherit from omni.ui.scene.SceneView causes the TestWidget instance to be rendered on top of the viewport. How should this be set up now?
Are there any release notes on the scene_view XR utils extensions?
PS. The code above would work with Kit 107 when using the following imports instead:
from omni.kit.xr.scene_view.utils.ui_container import UiContainer
from omni.kit.xr.scene_view.utils.manipulator_components.widget_component import WidgetComponent
from omni.kit.xr.scene_view.utils.spatial_source import SpatialSource

