Skip to content

Commit

Permalink
Fix race condition before the window is created
Browse files Browse the repository at this point in the history
  • Loading branch information
syntway committed Oct 29, 2022
1 parent f6cee04 commit 9786e1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This tool is a plain Omniverse extension that can be installed as any other exte
1. Download the release or clone the repository into your computer.
2. In the Omniverse App (Create, Code, etc.), open the Extensions window from: Window menu > Extensions.
3. In the Extensions window, open the Settings page, by clicking the small gear button at the top of the left bar.
4. In the Settings page that appears at the right appears a list of Extension Search Paths. Add the path location of the exts/ subfolder. This subfolder is inside the location to where you installed in step 1.
4. In the Settings page that appears at the right, you'll see a list of Extension Search Paths. Add the path location of the exts/ subfolder. This subfolder is inside the location to where you installed in step 1.
5. In the search field at the top left bar, next to the gear button, type model exploder - the tool should appear listed - click it.
6. information about the Model Exploder tool will appear at the right side: check the Enabled and the Autoload checkboxes. The tool is now installed in your Omniverse app.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pxr import Gf, Tf, Sdf, Usd, UsdGeom, CameraUtil


VERSION = 10
VERSION = 11


def call_after_update(fn, update_count=1):
Expand Down Expand Up @@ -141,6 +141,9 @@ def set_setting(path, value):
carb.settings.get_settings().set(path, value)


def delete_setting(path):
carb.settings.get_settings().destroy_item(path)


def get_extension_path(ext_id, sub_path=None):
ext_path = omni.kit.app.get_app().get_extension_manager().get_extension_path(ext_id)
Expand Down
6 changes: 6 additions & 0 deletions exts/syntway.model_exploder/syntway/model_exploder/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, title: str, ext_id: str, **kwargs):

self.auto_resize = True

self._ui_built = False
self.frame.set_build_fn(self._build_fn)

self._vp = ViewportHelper()
Expand Down Expand Up @@ -279,6 +280,8 @@ def get_dist_mult_index(dist_mult):
#ui.Button("Test", clicked_fn=self._on_test)


self._ui_built = True

self._refresh_ui()


Expand All @@ -288,6 +291,9 @@ def get_dist_mult_index(dist_mult):
def _on_stage_event(self, ev: carb.events.IEvent):
# print("Window._on_stage_event", ev.type)

if not self._ui_built: # a stage event can call us before _build_fn()
return

if ev.type == int(omni.usd.StageEventType.SELECTION_CHANGED):
if not self._engine.has_meshes:
self._refresh_ui()
Expand Down

0 comments on commit 9786e1b

Please sign in to comment.