"""Support required by the Carbonite extension loader."""
import omni.ext

# binding for C++ plugin interface
from ..bindings._omni_graph_expression import acquire_interface as _acquire_interface  # noqa: PLE0402
from ..bindings._omni_graph_expression import release_interface as _release_interface  # noqa: PLE0402

# python scripted node
from ..nodes.OgnExpression import OgnExpression as _OgnExpression  # noqa: PLE0402


class _PublicExtension(omni.ext.IExt):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.__interface = None

    def on_startup(self):
        self.__interface = _acquire_interface()

    def on_shutdown(self):
        if self.__interface is not None:
            _release_interface(self.__interface)
            self.__interface = None
        _OgnExpression.on_shutdown()
