from typing import Union
import omni.ext
import omni.ui as ui

from omni.rtx.window.settings import RendererSettingsFactory

from .widgets.common_widgets import CommonIRaySettingStack


class IRaySettingsExtension(omni.ext.IExt):
    """The entry point for RTX - Accurate (Iray) Settings Window"""

    MENU_PATH = "Rendering"

    def on_startup(self):
        RendererSettingsFactory.register_renderer("Accurate (Iray)", ["Common", "Accurate (Iray)", "Post Processing"])
        RendererSettingsFactory.register_stack("Accurate (Iray)", CommonIRaySettingStack)

    def on_shutdown(self):
        RendererSettingsFactory.unregister_renderer("Accurate (Iray)")
        RendererSettingsFactory.unregister_stack("Accurate (Iray)")
        RendererSettingsFactory.build_ui()
