Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ find_package(Python REQUIRED COMPONENTS Development)

add_subdirectory(moonrayShaderDiscovery)
add_subdirectory(moonrayShaderParser)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sitecustomize.py
DESTINATION lib/python
)
3 changes: 3 additions & 0 deletions moonrayShaderDiscovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ install(FILES ${plugInfoFile}
DESTINATION plugin/pxr/moonrayShaderDiscovery
)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
DESTINATION lib/python/pxr/MoonrayShaderDiscovery
)
3 changes: 3 additions & 0 deletions moonrayShaderParser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ install(FILES ${plugInfoFile}
DESTINATION plugin/pxr/moonrayShaderParser
)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
DESTINATION lib/python/pxr/MoonrayShaderParser
)

19 changes: 19 additions & 0 deletions sitecustomize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Expose MoonRay's USD Python plugin stubs to Houdini's pxr package.

Houdini ships pxr as a regular Python package instead of a namespace package, so
adding MoonRay's lib/python directory to PYTHONPATH is not enough for imports
such as pxr.MoonrayShaderParser. The Sdr plugins are native USD plugins; these
small Python stubs only prevent Plug from reporting missing Python modules when
the native parser/discovery plugins are loaded.
"""

import os

try:
import pxr

moonray_pxr_path = os.path.join(os.path.dirname(__file__), "pxr")
if hasattr(pxr, "__path__") and moonray_pxr_path not in pxr.__path__:
pxr.__path__.append(moonray_pxr_path)
except Exception:
pass