Upgrade to OpenUSD 25.11 (Python 3.12) and fix Arnold/Embree regressions
Build against OpenUSD 25.11 built from source with Python 3.12, OCIO 2.2.1, OpenVDB, Ptex and Embree, replacing the 25.05/py311 mix. Build system: - CMAKE_PREFIX_PATH -> third_party/OpenUSD-v25.11; HDARNOLD_ROOT -> hdArnold-v25.11. hdEmbree is bundled in the USD build now, so HDEMBREE_USD_ROOT is no longer needed. - FindOpenUSD: drop usd_ndr (ndr was merged into sdr in 25.11). - hdArnold plugin renames: ndrArnold -> nodeRegistryArnold, plus the new usdImagingArnold plugin. - Glob the version-suffixed OpenColorIO_*.dll instead of hardcoding 2_1. - Drop the python311.dll workaround; USD and Cycles now share Python 3.12. - Cycles: deploy OpenColorIO_2_5.dll (needed by its bundled OpenImageIO) and stop the debug-DLL filter from eating IlmThread.dll -- the regex `d[.]dll$` also matched legitimate Release DLLs. Runtime fixes: - cullStyle now defaults to Nothing, matching usdview (viewSettingsDataModel cullBackfaces=False). BackUnlessDoubleSided drops back faces on geometry that isn't authored doubleSided, which hdEmbree applies to occlusion rays too, so interiors shaded as single-sided. - Set HDARNOLD_osl_includepath (and PXR_MTLX_STDLIB_SEARCH_PATHS) in main.cpp before the plugin DLL pre-load. hdArnold compiles MaterialX via generated OSL that begins with #include "mx_funcs.h"; without an include path Arnold fails with "fatal error: 'mx_funcs.h' file not found". It must be set before any plugin loads because TF_DEFINE_ENV_SETTING caches the value when hdArnold.dll registers its settings. - Deploy the MaterialX standard library next to the executable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Build directories
|
||||
build/
|
||||
build_*/
|
||||
install/
|
||||
out/
|
||||
.kilocode/
|
||||
|
||||
@@ -7,7 +7,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
## Build
|
||||
|
||||
**Prerequisites:** MSVC 2022, CMake ≥ 3.20, Python 3.12 at `%LOCALAPPDATA%\Programs\Python\Python312`.
|
||||
OpenUSD 25.05 is expected at `third_party/OpenUSD-v25.05` (set via `CMAKE_PREFIX_PATH` in the preset).
|
||||
OpenUSD 25.11 is expected at `third_party/OpenUSD-v25.11` (set via `CMAKE_PREFIX_PATH` in the preset).
|
||||
|
||||
```powershell
|
||||
# Configure (one-time; downloads ACES 1.2 OCIO config ~124 MB on first run)
|
||||
@@ -20,11 +20,11 @@ cmake --build build --config Release
|
||||
cmake --build build --config Release --target install
|
||||
```
|
||||
|
||||
The `default` preset (in `CMakePresets.json`) enables `WITH_CYCLES=ON`, `HDARNOLD_ROOT`, and `HDEMBREE_USD_ROOT` for the maintainer's machine. For a minimal build without optional render delegates, configure manually:
|
||||
The `default` preset (in `CMakePresets.json`) enables `WITH_CYCLES=ON` and `HDARNOLD_ROOT` for the maintainer's machine. hdEmbree is bundled directly in the `third_party/OpenUSD-v25.11` build (built with `--embree`), so no separate `HDEMBREE_USD_ROOT` is needed. For a minimal build without optional render delegates, configure manually:
|
||||
|
||||
```powershell
|
||||
cmake -B build -G "Visual Studio 17 2022" `
|
||||
-DCMAKE_PREFIX_PATH="third_party/OpenUSD-v25.05" `
|
||||
-DCMAKE_PREFIX_PATH="third_party/OpenUSD-v25.11" `
|
||||
-DIMGUI_DIR="third_party/imgui-1.92.7" `
|
||||
-DWITH_CYCLES=OFF
|
||||
```
|
||||
|
||||
+75
-45
@@ -63,9 +63,13 @@ set(ARNOLD_LOCATION "" CACHE PATH "Arnold SDK root (e.g. C:/Autodesk/mtoa/5.5.0/
|
||||
if(HDARNOLD_ROOT AND EXISTS "${HDARNOLD_ROOT}/plugin/hdArnold.dll")
|
||||
set(OPENUSD_HAS_ARNOLD TRUE)
|
||||
set(HDARNOLD_DLL "${HDARNOLD_ROOT}/plugin/hdArnold.dll")
|
||||
set(NDRARNOLD_DLL "${HDARNOLD_ROOT}/plugin/ndrArnold.dll")
|
||||
set(HDARNOLD_PLUGIN_DIR "${HDARNOLD_ROOT}/plugin/hdArnold")
|
||||
set(NDRARNOLD_PLUGIN_DIR "${HDARNOLD_ROOT}/plugin/ndrArnold")
|
||||
# arnold-usd renamed the ndr plugin to node_registry (USD merged ndr into
|
||||
# sdr as of PXR_VERSION 2505) and added a usdImaging adapter plugin.
|
||||
set(NDRARNOLD_DLL "${HDARNOLD_ROOT}/plugin/nodeRegistryArnold.dll")
|
||||
set(NDRARNOLD_PLUGIN_DIR "${HDARNOLD_ROOT}/plugin/nodeRegistryArnold")
|
||||
set(USDIMAGINGARNOLD_DLL "${HDARNOLD_ROOT}/plugin/usdImagingArnold.dll")
|
||||
set(USDIMAGINGARNOLD_PLUGIN_DIR "${HDARNOLD_ROOT}/plugin/usdImagingArnold")
|
||||
if(ARNOLD_LOCATION AND EXISTS "${ARNOLD_LOCATION}/bin/ai.dll")
|
||||
set(ARNOLD_AI_DLL "${ARNOLD_LOCATION}/bin/ai.dll")
|
||||
# ai.dll also requires companion runtime DLLs (OIDN denoiser, Adsk licensing, cer)
|
||||
@@ -98,6 +102,12 @@ set(HDCYCLES_PLUGIN_DIR "${CYCLES_INSTALL_DIR}/hydra/hdCycles")
|
||||
# tbb12.dll is required by openvdb/embree4 but lives in the precompiled lib tree,
|
||||
# not in the install output — deploy it explicitly.
|
||||
set(CYCLES_TBB12_DLL "${CMAKE_SOURCE_DIR}/third_party/cycles/lib/windows_x64/tbb/bin/tbb12.dll")
|
||||
# OpenColorIO_2_5.dll: Cycles' bundled prebuilt OpenImageIO.dll was compiled
|
||||
# against Cycles' own OCIO 2.5 (forced via -DOpenColorIO_DIR below, to avoid
|
||||
# USD's OCIO headers shadowing Cycles' during the ExternalProject build) —
|
||||
# distinct from and required alongside USD's own OpenColorIO_2_2.dll. It also
|
||||
# lives only in the precompiled lib tree, not in cycles_install's output.
|
||||
set(CYCLES_OCIO25_DLL "${CMAKE_SOURCE_DIR}/third_party/cycles/lib/windows_x64/opencolorio/bin/OpenColorIO_2_5.dll")
|
||||
|
||||
if(WITH_CYCLES)
|
||||
include(ExternalProject)
|
||||
@@ -228,13 +238,20 @@ if(WIN32)
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
|
||||
# OpenColorIO DLL — copy from USD bin/ (which already ships OpenColorIO_2_1.dll)
|
||||
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${OpenUSD_ROOT_DIR}/bin/OpenColorIO_2_1.dll"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>"
|
||||
COMMENT "Copying OpenColorIO runtime DLL..."
|
||||
)
|
||||
# OpenColorIO DLL — copy from USD bin/. Filename is version-suffixed
|
||||
# (e.g. OpenColorIO_2_2.dll) and changes whenever the USD build's bundled
|
||||
# OCIO version changes, so glob for it instead of hardcoding the version.
|
||||
file(GLOB OPENCOLORIO_RUNTIME_DLL "${OpenUSD_ROOT_DIR}/bin/OpenColorIO_*.dll")
|
||||
if(OPENCOLORIO_RUNTIME_DLL)
|
||||
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${OPENCOLORIO_RUNTIME_DLL}
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>"
|
||||
COMMENT "Copying OpenColorIO runtime DLL..."
|
||||
)
|
||||
else()
|
||||
message(WARNING "OpenColorIO runtime DLL not found in ${OpenUSD_ROOT_DIR}/bin")
|
||||
endif()
|
||||
|
||||
# FFmpeg DLLs — copy all .dll files from third_party/ffmpeg/bin
|
||||
file(GLOB FFMPEG_RUNTIME_DLLS "${CMAKE_SOURCE_DIR}/third_party/ffmpeg/bin/*.dll")
|
||||
@@ -323,13 +340,19 @@ if(WIN32)
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/hdArnold.dll"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${NDRARNOLD_DLL}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/ndrArnold.dll"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/nodeRegistryArnold.dll"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${HDARNOLD_PLUGIN_DIR}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/hdArnold"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${NDRARNOLD_PLUGIN_DIR}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/ndrArnold"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/nodeRegistryArnold"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${USDIMAGINGARNOLD_DLL}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/usdImagingArnold.dll"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${USDIMAGINGARNOLD_PLUGIN_DIR}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/usdImagingArnold"
|
||||
COMMENT "Copying hdArnold plugin..."
|
||||
)
|
||||
if(ARNOLD_RUNTIME_DLLS)
|
||||
@@ -367,8 +390,10 @@ if(WIN32)
|
||||
" endif()\n"
|
||||
# Exclude debug-variant DLLs (not needed in release, just wasted space).
|
||||
# Pattern: OpenColorIO_d_2_5.dll → contains "_d_"
|
||||
# openjph.0.25d.dll → ends with "d.dll"
|
||||
" if(_lname MATCHES \"_d_\" OR _lname MATCHES \"d[.]dll$\")\n"
|
||||
# openjph.0.25d.dll → version digit directly followed by "d.dll"
|
||||
# NOTE: must require a digit before the trailing "d" — a bare "d[.]dll$"
|
||||
# also matches legitimate Release DLLs like IlmThread.dll (ends in "...ead.dll").
|
||||
" if(_lname MATCHES \"_d_\" OR _lname MATCHES \"[0-9]d[.]dll$\")\n"
|
||||
" continue()\n"
|
||||
" endif()\n"
|
||||
" list(APPEND _dlls \"\${_dll}\")\n"
|
||||
@@ -391,6 +416,10 @@ if(WIN32)
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CYCLES_TBB12_DLL}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/tbb12.dll"
|
||||
# OpenColorIO_2_5.dll is required by Cycles' bundled OpenImageIO.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CYCLES_OCIO25_DLL}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/OpenColorIO_2_5.dll"
|
||||
COMMENT "Copying hdCycles plugin and runtime DLLs..."
|
||||
)
|
||||
endif()
|
||||
@@ -468,6 +497,14 @@ if(OPENUSD_HAS_ARNOLD)
|
||||
DESTINATION bin/usd
|
||||
OPTIONAL
|
||||
)
|
||||
install(FILES "${USDIMAGINGARNOLD_DLL}"
|
||||
DESTINATION bin/usd
|
||||
OPTIONAL
|
||||
)
|
||||
install(DIRECTORY "${USDIMAGINGARNOLD_PLUGIN_DIR}"
|
||||
DESTINATION bin/usd
|
||||
OPTIONAL
|
||||
)
|
||||
if(ARNOLD_RUNTIME_DLLS)
|
||||
install(FILES ${ARNOLD_RUNTIME_DLLS}
|
||||
DESTINATION bin
|
||||
@@ -511,32 +548,20 @@ if(OPENUSD_HAS_CYCLES)
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
# OpenColorIO_2_5.dll (used by Cycles' bundled OpenImageIO.dll) — same story
|
||||
install(FILES "${CYCLES_OCIO25_DLL}"
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
|
||||
# Install Python runtime DLLs required by OpenUSD and Cycles.
|
||||
# python312.dll : linked by Cycles (hdCycles.dll → python312.dll)
|
||||
# python311.dll : linked by usd_python.dll (the OpenUSD Python bindings were
|
||||
# built against Python 3.11, regardless of what we compile with)
|
||||
# Detect python311.dll from common install paths.
|
||||
foreach(_pyroot
|
||||
"$ENV{LOCALAPPDATA}/Programs/Python/Python311"
|
||||
"C:/Python311"
|
||||
"C:/Program Files/Python311"
|
||||
)
|
||||
if(EXISTS "${_pyroot}/python311.dll")
|
||||
set(PYTHON311_DLL "${_pyroot}/python311.dll")
|
||||
message(STATUS "Found python311.dll (required by usd_python.dll): ${PYTHON311_DLL}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# python312.dll: linked by both Cycles (hdCycles.dll) and USD's Python bindings
|
||||
# (usd_python.dll) — the OpenUSD build and Cycles now share the same Python 3.12.
|
||||
set(_python_runtime_dlls
|
||||
"$ENV{LOCALAPPDATA}/Programs/Python/Python312/python312.dll"
|
||||
"$ENV{LOCALAPPDATA}/Programs/Python/Python312/python3.dll"
|
||||
)
|
||||
if(PYTHON311_DLL)
|
||||
list(APPEND _python_runtime_dlls "${PYTHON311_DLL}")
|
||||
endif()
|
||||
|
||||
install(FILES ${_python_runtime_dlls}
|
||||
DESTINATION bin
|
||||
@@ -544,17 +569,6 @@ install(FILES ${_python_runtime_dlls}
|
||||
# system-wide Python; in that case the DLL is on PATH already.
|
||||
)
|
||||
|
||||
# Also copy python311.dll to the build output directory so debug runs work
|
||||
# without requiring C:\Python311 to be on PATH.
|
||||
if(PYTHON311_DLL)
|
||||
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${PYTHON311_DLL}"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/python311.dll"
|
||||
COMMENT "Copying python311.dll (for usd_python.dll)..."
|
||||
)
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# OCIO: download ACES 1.2 config at configure time if not present
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -662,7 +676,15 @@ add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/resources/vdb"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/resources/vdb"
|
||||
COMMENT "Copying fonts, SVG icons, HDRI presets and preview shapes to build output"
|
||||
# MaterialX standard library (nodedefs + genosl headers such as mx_funcs.h).
|
||||
# hdArnold reads PXR_MTLX_STDLIB_SEARCH_PATHS to locate these; without them
|
||||
# Arnold's OSL compile of MaterialX shaders fails with
|
||||
# "fatal error: 'mx_funcs.h' file not found". Application.cpp points the
|
||||
# env var at this deployed copy.
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${OpenUSD_ROOT_DIR}/libraries"
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>/libraries"
|
||||
COMMENT "Copying fonts, SVG icons, HDRI presets, preview shapes and MaterialX stdlib to build output"
|
||||
)
|
||||
|
||||
# Copy ACES OCIO config to build output — only on first build (skipped if already present).
|
||||
@@ -678,7 +700,7 @@ endif()
|
||||
|
||||
# Install OpenColorIO DLL (from the OpenUSD distribution's bin/)
|
||||
install(FILES
|
||||
"${OpenUSD_ROOT_DIR}/bin/OpenColorIO_2_1.dll"
|
||||
${OPENCOLORIO_RUNTIME_DLL}
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
@@ -689,6 +711,14 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources
|
||||
DESTINATION bin
|
||||
)
|
||||
|
||||
# MaterialX standard library — required by hdArnold's OSL codegen (mx_funcs.h).
|
||||
# See the matching POST_BUILD copy above and PXR_MTLX_STDLIB_SEARCH_PATHS in
|
||||
# Application.cpp.
|
||||
install(DIRECTORY "${OpenUSD_ROOT_DIR}/libraries"
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
|
||||
# Install Inter font next to the exe under resources/font/
|
||||
# ImGuiContext tries "resources/font/Inter.ttf" then "resources/font/Inter.ttc".
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/third_party/Inter/Inter.ttc
|
||||
|
||||
+3
-4
@@ -9,15 +9,14 @@
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install",
|
||||
"CMAKE_PREFIX_PATH": "${sourceDir}/third_party/OpenUSD-v25.05",
|
||||
"CMAKE_PREFIX_PATH": "${sourceDir}/third_party/OpenUSD-v25.11",
|
||||
"IMGUI_DIR": "${sourceDir}/third_party/imgui-1.92.7",
|
||||
"CMAKE_CXX_STANDARD": "17",
|
||||
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
|
||||
"BUILD_TESTS": "OFF",
|
||||
"WITH_CYCLES": "ON",
|
||||
"HDARNOLD_ROOT": "E:/library/hdArnold",
|
||||
"ARNOLD_LOCATION": "C:/Autodesk/mtoa/5.5.0/2026",
|
||||
"HDEMBREE_USD_ROOT": "E:/USD_v25.05_embree"
|
||||
"HDARNOLD_ROOT": "E:/library/hdArnold-v25.11",
|
||||
"ARNOLD_LOCATION": "C:/Autodesk/mtoa/5.5.0/2026"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# USD Layer Manager
|
||||
|
||||
A C++17 / Windows desktop application providing a **Maya-style** USD scene and look-dev editor using **OpenUSD v25.05**, **ImGui 1.92.7** (docking branch), and **OpenGL 3.3** (via GLAD). Users can open, edit, and save USD files, manage layered stage overrides, inspect and edit prim properties, author UsdShade material graphs with a live shader-ball preview, animate with a Bezier curve editor, and interact with 3D scenes through a multi-viewport Hydra renderer with OCIO color management.
|
||||
A C++17 / Windows desktop application providing a **Maya-style** USD scene and look-dev editor using **OpenUSD v25.11**, **ImGui 1.92.7** (docking branch), and **OpenGL 3.3** (via GLAD). Users can open, edit, and save USD files, manage layered stage overrides, inspect and edit prim properties, author UsdShade material graphs with a live shader-ball preview, animate with a Bezier curve editor, and interact with 3D scenes through a multi-viewport Hydra renderer with OCIO color management.
|
||||
|
||||

|
||||
|
||||
@@ -26,7 +26,7 @@ A C++17 / Windows desktop application providing a **Maya-style** USD scene and l
|
||||
|
||||
| Dependency | Version | Notes |
|
||||
|---|---|---|
|
||||
| [OpenUSD](https://github.com/PixarAnimationStudios/OpenUSD) | v25.05 | Prebuilt; found via `FindOpenUSD.cmake` |
|
||||
| [OpenUSD](https://github.com/PixarAnimationStudios/OpenUSD) | v25.11 | Prebuilt; found via `FindOpenUSD.cmake` |
|
||||
| [Dear ImGui](https://github.com/ocornut/imgui) | v1.92.7 | Docking branch; Win32 + OpenGL3 backends |
|
||||
| [GLAD](https://glad.dav1d.de/) | — | OpenGL 3.3 core loader |
|
||||
| Python | 3.12 | Required by OpenUSD runtime (`python312.dll`) |
|
||||
@@ -35,8 +35,8 @@ A C++17 / Windows desktop application providing a **Maya-style** USD scene and l
|
||||
|
||||
| Delegate | Renderer Version | Variable | Notes |
|
||||
|---|---|---|---|
|
||||
| **hdEmbree** | Embree 4.4.1 | `HDEMBREE_USD_ROOT` | USD build with `PXR_ENABLE_EMBREE_PLUGIN=ON`; set `EMBREE_LOCATION` if Embree DLLs are not in `HDEMBREE_USD_ROOT/bin` |
|
||||
| **hdArnold** | Arnold 7.4.0 (MtoA 5.5.0) | `HDARNOLD_ROOT`, `ARNOLD_LOCATION` | [arnold-usd](https://github.com/Autodesk/arnold-usd) install dir + MtoA root for `ai.dll` |
|
||||
| **hdEmbree** | Embree 4.3.3 | `HDEMBREE_USD_ROOT` (optional) | Bundled directly in `third_party/OpenUSD-v25.11` (built with `--embree`); set `HDEMBREE_USD_ROOT` only if using a separate USD build, and `EMBREE_LOCATION` if Embree DLLs aren't in its `bin/` |
|
||||
| **hdArnold** | Arnold 7.4.0 (MtoA 5.5.0) | `HDARNOLD_ROOT`, `ARNOLD_LOCATION` | [arnold-usd](https://github.com/Autodesk/arnold-usd) (tag `Arnold-7.4.5.1`, for USD 25.11's `ndr`→`sdr` API change) install dir + MtoA root for `ai.dll` |
|
||||
| **hdCycles** | Cycles 5.2.0 | `WITH_CYCLES=ON` | Built from source under `third_party/cycles` via ExternalProject; requires MSVC |
|
||||
|
||||
All delegate paths are pre-configured in `CMakePresets.json`.
|
||||
@@ -166,7 +166,7 @@ Use Kilo's `openspec-*` skills to streamline this workflow.
|
||||
Before writing any OpenUSD API call, verify the API exists in the actual SDK:
|
||||
|
||||
```powershell
|
||||
findstr /r /s "FunctionName" third_party\OpenUSD_v25.05\include\
|
||||
findstr /r /s "FunctionName" third_party\OpenUSD-v25.11\include\
|
||||
```
|
||||
|
||||
Always build and install before manually verifying a change:
|
||||
|
||||
@@ -72,7 +72,6 @@ set(OpenUSD_REQUIRED_LIBS
|
||||
hio
|
||||
ar
|
||||
kind
|
||||
ndr
|
||||
sdr
|
||||
python
|
||||
cameraUtil
|
||||
|
||||
@@ -174,7 +174,7 @@ UsdSceneRenderer::UsdSceneRenderer()
|
||||
, m_aaEnabled(false)
|
||||
, m_backgroundColor(0.15f, 0.15f, 0.15f)
|
||||
, m_shadingMode(ShadingMode::SmoothShaded)
|
||||
, m_cullStyle(CullStyle::BackUnlessDoubleSided)
|
||||
, m_cullStyle(CullStyle::Nothing) // matches usdview; see ViewportTileSettings::cullStyle
|
||||
, m_colorCorrectionMode(ColorCorrectionMode::sRGB)
|
||||
, m_ambientLightOnly(true)
|
||||
, m_domeLightEnabled(false)
|
||||
|
||||
@@ -19,6 +19,45 @@ static void SetUsdPluginPath() {
|
||||
std::string pluginPath = exeDir + "\\usd";
|
||||
SetEnvironmentVariableA("PXR_PLUGINPATH_NAME", pluginPath.c_str());
|
||||
|
||||
// --- MaterialX / Arnold OSL include path -------------------------------
|
||||
// hdArnold compiles MaterialX shaders by generating OSL whose first line is
|
||||
// #include "mx_funcs.h"
|
||||
// and compiling it as an "osl" node's `code` parameter. Without an include
|
||||
// path that compile fails with:
|
||||
// [osl] error: <buffer>:2:10: fatal error: 'mx_funcs.h' file not found
|
||||
//
|
||||
// The knob is Arnold's options.osl_includepath, which hdArnold exposes as the
|
||||
// HDARNOLD_osl_includepath env setting (render_delegate/config.cpp).
|
||||
//
|
||||
// THIS MUST BE SET BEFORE ANY PLUGIN DLL IS LOADED. TF_DEFINE_ENV_SETTING
|
||||
// registers a TF_REGISTRY_FUNCTION that eagerly calls TfGetEnvSetting() and
|
||||
// caches the value permanently when hdArnold.dll loads -- which the
|
||||
// LoadLibraryA pre-flight below does. Setting it later (e.g. from
|
||||
// Application::Initialize) is silently ignored.
|
||||
//
|
||||
// Set via both the CRT (_putenv_s -> getenv) and the Win32 block
|
||||
// (SetEnvironmentVariableA) since the two are not kept in sync on Windows.
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
const std::string mtlxLibs = exeDir + "\\libraries";
|
||||
const std::string mtlxOslInclude = mtlxLibs + "\\stdlib\\genosl\\include";
|
||||
|
||||
if (fs::exists(mtlxOslInclude)) {
|
||||
if (!getenv("HDARNOLD_osl_includepath")) {
|
||||
_putenv_s("HDARNOLD_osl_includepath", mtlxOslInclude.c_str());
|
||||
SetEnvironmentVariableA("HDARNOLD_osl_includepath",
|
||||
mtlxOslInclude.c_str());
|
||||
}
|
||||
// Nodedef lookup (MATERIALX_NODE_DEFINITIONS). Separate knob from
|
||||
// the OSL include path above -- it does NOT fix the include error.
|
||||
if (!getenv("PXR_MTLX_STDLIB_SEARCH_PATHS")) {
|
||||
_putenv_s("PXR_MTLX_STDLIB_SEARCH_PATHS", mtlxLibs.c_str());
|
||||
SetEnvironmentVariableA("PXR_MTLX_STDLIB_SEARCH_PATHS",
|
||||
mtlxLibs.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> pluginPaths;
|
||||
WIN32_FIND_DATAA findData;
|
||||
std::string searchPattern = pluginPath + "\\*";
|
||||
|
||||
@@ -177,6 +177,18 @@ bool Application::Initialize(const std::string& windowTitle, int width, int heig
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: HDARNOLD_osl_includepath / PXR_MTLX_STDLIB_SEARCH_PATHS are set in
|
||||
// main.cpp, NOT here. They must be in the environment before the plugin
|
||||
// DLLs are loaded, because TF_DEFINE_ENV_SETTING caches the value when
|
||||
// hdArnold.dll registers its settings. Setting them at this point is too
|
||||
// late and is silently ignored.
|
||||
if (const char* oslInc = getenv("HDARNOLD_osl_includepath")) {
|
||||
LOG_INFO(std::string("Arnold OSL include path: ") + oslInc);
|
||||
} else {
|
||||
LOG_WARNING("HDARNOLD_osl_includepath not set — Arnold MaterialX "
|
||||
"shaders will fail to compile ('mx_funcs.h' not found)");
|
||||
}
|
||||
|
||||
// Load per-viewport settings and global preferences from AppData.
|
||||
if (const char* appData = getenv("APPDATA")) {
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -32,7 +32,11 @@ struct ViewportTileSettings {
|
||||
bool ambientLightOnly = true;
|
||||
bool domeLightEnabled = false;
|
||||
int shadingMode = 0;
|
||||
int cullStyle = 4; // CullStyle::BackUnlessDoubleSided
|
||||
// CullStyle::Nothing — matches usdview's default (viewSettingsDataModel
|
||||
// cullBackfaces=False -> CULL_STYLE_NOTHING). BackUnlessDoubleSided drops
|
||||
// back faces on geometry that isn't authored doubleSided, which hdEmbree
|
||||
// applies to occlusion rays as well, so interiors shade as single-sided.
|
||||
int cullStyle = 1; // CullStyle::Nothing
|
||||
bool showGuides = false;
|
||||
bool showProxy = true;
|
||||
bool showRender = false;
|
||||
|
||||
Reference in New Issue
Block a user