I am writing an Omniverse Extension. Part of the UI is a dropdown box with all of the stage’s Xforms. I want the contents of the dropdown box to be updated any time an Xform is added or deleted in the scene. I tried with subscribing to stage events but unfortunately it seems there is no event when an Xform is added, only if it is deleted.
- How can my code be notified properly about Xform added or deleted?
- How can I update the model’s items accordingly? I use isaac’s dropdown_builder to create it.
Thanks a lot
You might consider basing your extension off of the Stage extension since it accurately tracks changes to Xforms.
isaac-sim/kit/extscore/omni.usd/omni/usd/_impl/utils.py, which gets changes and updates the cache (including deletion) for usd property changes, and creates the listener for changes. If possible I would interface this module rather than borrowing code from it.
The Stage extension also can apply updates to models, and the code to do so should live in either the
omni.usdpackage path, the
omni.kit.widget.stage package path, or the
omni.kit.stage_column package path.
I think what you suggest is what I am looking for. Still I am a bit lost on how to proceed.
do you mean deriving my extension class from omni.kit.window.stage? Or omni.kit.widget.stage?
Which part of utils.py are taking care of monitoring changes. Is it PrimCaching?
Well, here is what I did, after looking at the code of omni.kit.widget.stage:
self._stage_listener = Tf.Notice.Register(
def _on_objects_changed(self, notice, sender):
paths = notice.GetResyncedPaths()
prim_path = False
for path in paths:
prim_path = True
if not prim_path:
Now I can react on any prim changes, which is ok for the moment.
@bruno.vetter you have the right idea. Have a look at this documentation in case on of the other UsdNotice functions fit your case better: Universal Scene Description: UsdNotice::ObjectsChanged Class Reference
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.