import omni.ext
import os
from pathlib import Path

    
# path to set to the environment variable `PXR_MTLX_STDLIB_SEARCH_PATHS` while usd is initialized
# i.e., called by omni.usd.config 
def get_mtlx_stdlib_search_path() -> str:
    # compute the real path without symlinks in order to get it working with usdmtlx
    current_dir = os.path.dirname(__file__)
    mtlx_libraries_dir = os.path.join(current_dir, '..', '..', 'libraries')
    mtlx_libraries_dir = os.path.realpath(mtlx_libraries_dir)
    return str(Path(mtlx_libraries_dir).resolve())

class MtlxExtension(omni.ext.IExt):
    def on_startup(self):
        pass
    
    def on_shutdown(self):
        pass