Measure Tool not working in USD explorer template, kit-sdk 107.0

Steps:

  1. Create a new project based on the USD explorer template.
  2. Ensure that the measure tool is in the dependencies in the .kit file (it was already there for me).
  3. Run the project.
  4. Go to the menu Tools → Measure.
  5. Observe that the Measure panel does not appear, although the checkmark gets toggled on the menu for the Measure Tool.
  6. Observe the following error displayed in red at the bottom status bar of the editor:
TypeError: Extension._show_window() missing 2 required positional arguments: `menu and `value`

Note: same bug with the editor template.

I am sorry but I cannot reproduce it in Explorer. Explorer comes with the measure tool built in. I just build all the four templates from the latest 107.03 and the measure tool works fine. No errors at all. Maybe you should flush and rebuild your templates.

However, I do see that error in using Measure in Composer.

Thanks - I can try later this week

Hi, I am having the same issue, and I have the latest kit template too. 107, in Explorer.

It is working in Explorer when I am in review mode

I’ve got the same issue using the Composer Template in KIT 107 (main)

console says :
2025-04-09 09:49:09 [Error] [omni.ui.python] TypeError: Extension._show_window() missing 2 required positional arguments: ‘menu’ and ‘value’

Hi @Richard3D , some more context. It appears that the Measure extension’s _show_window menu function is being called without the required parameters. I’ve confirmed this by going to the extension’s extension.py, and adding the following function:

    def show_window_with_logging(self):
        import traceback
        import carb

        carb.log_info("[DEBUG] Measure menu clicked (no args)")
        stack = ''.join(traceback.format_stack())
        carb.log_error("[DEBUG] Callstack:\n" + stack)

        self._show_window(None, True)

And then substituting it inside the extension’s on_startup call:

        self._menu_entry = [
            MenuItemDescription(
                name=EXTENSION_NAME,
                ticked=False,
                ticked_fn=self._is_visible,
                onclick_fn=self.show_window_with_logging
            )
        ]

        # self._menu_entry = [
        #     MenuItemDescription(
        #         name=EXTENSION_NAME,
        #         ticked=False,
        #         ticked_fn=self._is_visible,
        #         onclick_fn=self._show_window,
        #     )
        # ]

The measure panel shows now, and the log outputs a partial callstack (1 level):

2025-04-09 10:25:43 [16,471ms] [Error] [omni.kit.tool.measure.extension] [DEBUG] Callstack:
  File "d:/projects/omniverse/my-kit-project/_build/windows-x86_64/release/extscache/omni.kit.tool.measure-107.0.0+107.0.3/omni/kit/tool/measure/extension.py", line 74, in show_window_with_logging
    stack = ''.join(traceback.format_stack())

Which may indicate that the call is coming from C++ directly, since no additional python callstack shows.

This is on Windows 11, latest.

So it seems there exists at least one call path in the SDK that will treat this menu item as a toggle and not pass in a bool value for whether it should be on or not. It could be related to Linux vs Windows, and how tool menus are handled in Windows, but just a guess.

Interestingly, the omni.kit.window.section tool, which also shows under the Tools menu, works properly but registers its window showing in a different manner:

    def on_startup(self, ext_id):
        self._ext_id = ext_id
        # The ability to show up the window if the system requires it. We use it
        # in QuickLayout.
        self._window = None

        ui.Workspace.set_show_window_fn(WINDOW_NAME, partial(self.show_window, None))

While the measure tool uses add_menu_items(self._menu_entry, name="Tools") in on_startup. I suspect that may be the reason for the differing behavior, but at this point I hope I’ve provided enough to help track down the bug, since I’m not familiar with the SDK.

it seems that the callback signature has changed - quick n dirty fix for me in measure tool extension:

def _show_window(self):       
    if self._measure_panel:
        self._measure_panel.visible = True

[user]\appdata\local\ov\data\kit[your kit app]\0.1\exts\3\omni.kit.tool.measure-107.0.0+107.0.3\omni\kit\tool\measure\extension.py

1 Like

Hey!

Yeah, I ran into the same issue. It’s a bug in the current version — looks like the _show_window() method is being called without the right args. Quick fix is to open the extension code for the Measure Tool and update the _show_window function to handle missing menu and value parameters with defaults.

Or, as a temp workaround, you can manually open the panel from the Window → Extensions → Measure Tool menu. Not ideal, but it gets it visible.

Hopefully gets patched soon!

3 Likes

Hmm my post disappeared! Bummer, it was long…

Summary:

Substituting the _show_window function with a wrapped function that takes no parameters, in on_startup, of the Measure extension.py fixes the panel not showing:

    def show_window_with_logging(self):
        import traceback
        import carb

        carb.log_info("[DEBUG] Measure menu clicked (no args)")
        stack = ''.join(traceback.format_stack())
        carb.log_error("[DEBUG] Callstack:\n" + stack)

        self._show_window(None, True)

    def on_startup(self, ext_id) -> None:
        sections = ext_id.split("-")
        self._ext_name = sections[0]

        # Register commands
        commands.register()

        # Regiseter Property Widget
        self.__register_property_widget()

        # Initialize User Settings, Reference Manager, and Measurement Manager and Hotkey Manager
        UserSettings()
        ReferenceManager()
        MeasurementManager()
        AttributeValueCache()
        HotkeyManager()

        # Initialize Editor Window
        self._measure_panel: Optional[MeasurePanel] = MeasurePanel()
        ui.Workspace.set_show_window_fn(EXTENSION_NAME, partial(self._show_window, None))
        self._visibility_sub = ui.Workspace.set_window_visibility_changed_callback(self._on_visibility_changed)

        #eldebug
        self._menu_entry = [
            MenuItemDescription(
                name=EXTENSION_NAME,
                ticked=False,
                ticked_fn=self._is_visible,
                onclick_fn=self.show_window_with_logging
            )
        ]

        # self._menu_entry = [
        #     MenuItemDescription(
        #         name=EXTENSION_NAME,
        #         ticked=False,
        #         ticked_fn=self._is_visible,
        #         onclick_fn=self._show_window,
        #     )
        # ]

        add_menu_items(self._menu_entry, name="Tools")

And the section tool, which works fine normally, registers its window in a different way, so it seems the measure tool probably is using a different codepath which has bugs in some cases:

section tool on_startup:

    def on_startup(self, ext_id):
        self._ext_id = ext_id
        # The ability to show up the window if the system requires it. We use it
        # in QuickLayout.
        self._window = None

        ui.Workspace.set_show_window_fn(WINDOW_NAME, partial(self.show_window, None))

Thank you for this quick fix! Ill log this for our developers