I am creating a custom extension for Omniverse Create using the built-in omni
library. I have a simple window that creates a dropdown menu (CollapsableFrame
) with a TreeView
inside of it:
self._window = ui.Window("My Window", width = 300, height = 200)
self._items_count = 0
with self._window.frame:
with ui.VStack():
with ui.CollapsableFrame(f'My List {self._items_count} items:', collapsed = True):
tree_view = ui.TreeView(
self._model_all_usd,
root_visible = False,
header_visible = False,
columns_resizable = True,
column_widths = [ui.Fraction(0.4), ui.Fraction(0.3)],
style = {"TreeView.Item": {"margin": 4}})
I also have a function that I am using to listen for selection changes:
def _on_stage_event(self, event):
if event.type == int(omni.usd.StageEventType.SELECTION_CHANGED):
// do stuff
self._items_count += 1 # increase count whenever the selection changes
What I have currently will update the self._items_count
value, but the dropdown text does not update. How can I achieve this?
Just needed to make a reference to the
CollapsableFrame
:Then update by modifying the
title
property: