Skip to content

Commit

Permalink
Merging sirpalee/dev to master branch (#974)
Browse files Browse the repository at this point in the history
- Add a new ArnoldNodeGraph schema.
- Add a USD imaging adapter for the ArnoldNodeGraph schema.
- Refactor HdArnoldMaterial and HdArnoldMaterialTracker to work with arbitrary terminals.
- Add MaterialX support (disabled by default).

Fixes #964
Fixes #584
  • Loading branch information
sirpalee authored Dec 17, 2021
1 parent b45b4c5 commit 198da8f
Show file tree
Hide file tree
Showing 45 changed files with 2,063 additions and 572 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cmake-*
# Visual Studio Code
.vscode

# Generated plugInfo.json files
# Generated plugInfo.json.in files
*/**/plugInfo.json

# backup and temp
Expand Down
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ vars.AddVariables(
BoolVariable('BUILD_SCENE_DELEGATE', 'Whether or not to build the arnold scene delegate.', False),
BoolVariable('BUILD_TESTSUITE', 'Whether or not to build the testsuite.', True),
BoolVariable('BUILD_DOCS', 'Whether or not to build the documentation.', True),
BoolVariable('BUILD_DISABLE_HDMATERIALNETWORK2', 'Whether or not to disable support for HdMaterialNetwork2.', True),
BoolVariable('PROC_SCENE_FORMAT', 'Whether or not to build the procedural with a scene format plugin.', True),
BoolVariable('DISABLE_CXX11_ABI', 'Disable the use of the CXX11 abi for gcc/clang', False),
StringVariable('BOOST_LIB_NAME', 'Boost library name pattern', 'boost_%s'),
Expand Down
5 changes: 5 additions & 0 deletions cmake/modules/FindArnold.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ find_path(ARNOLD_PYTHON_DIR arnold/ai_array.py
PATHS "${ARNOLD_LOCATION}/python"
DOC "Arnold python directory path")

find_path(ARNOLD_MATERIALX_DIR arnold/nodedefs.mtlx
PATHS "${ARNOLD_LOCATION}/materialx"
"${ARNOLD_MATERIALX_LOCATION}"
DOC "Arnold MaterialX definitions.")

set(ARNOLD_LIBRARIES ${ARNOLD_LIBRARY})
set(ARNOLD_INCLUDE_DIRS ${ARNOLD_INCLUDE_DIR})
set(ARNOLD_PYTHON_DIRS ${ARNOLD_PYTHON_DIR})
Expand Down
128 changes: 128 additions & 0 deletions cmake/modules/FindMaterialX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. This License does not grant permission to use the trade
# names, trademarks, service marks, or product names of the Licensor
# and its affiliates, except as required to comply with Section 4(c) of
# the License and to reproduce the content of the NOTICE file.
#
# You may obtain a copy of the Apache License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Apache License with the above modification is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#
# - Find MaterialX Development Kit
#
# Finds an installed MaterialX Development Kit
#
# Variables that will be defined:
# MATERIALX_FOUND Defined if MaterialX has been detected
# MATERIALX_BASE_DIR Path to the root of the MaterialX installation
# MATERIALX_INCLUDE_DIRS Path to the MaterialX include directories
# MATERIALX_LIB_DIRS Path to the MaterialX library directories
# MATERIALX_STDLIB_DIR Path to the MaterialX standard library directory
# MATERIALX_LIBRARIES List of MaterialX libraries

#
# In:
# MATERIALX_ROOT Path to the root of the MaterialX installation
# MATERIALX_DATA_ROOT Path where MaterialX data files (libraries and
# resources) are installed, if different from
# MATERIALX_ROOT
#
# Out:
# MATERIALX_FOUND
# MATERIALX_INCLUDE_DIRS
# MATERIALX_LIB_DIRS
# MATERIALX_LIBRARIES

find_path(MATERIALX_BASE_DIR
NAMES
include/MaterialXCore/Library.h
HINTS
"${MATERIALX_ROOT}"
"$ENV{MATERIALX_ROOT}"
)

find_path(MATERIALX_INCLUDE_DIRS
MaterialXCore/Library.h
HINTS
"${MATERIALX_ROOT}"
"$ENV{MATERIALX_ROOT}"
"${MATERIALX_BASE_DIR}"
PATH_SUFFIXES
include
DOC
"MaterialX Header Path"
)

if (WIN32)
set(MATERIALX_CORE_STATIC_LIB_NAME MaterialXCore.lib)
set(MATERIALX_CORE_DYNAMIC_LIB_NAME MaterialXCore.dll)
else()
set(MATERIALX_CORE_STATIC_LIB_NAME libMaterialXCore.a)
if (APPLE)
set(MATERIALX_CORE_DYNAMIC_LIB_NAME libMaterialXCore.dylib)
else()
set(MATERIALX_CORE_DYNAMIC_LIB_NAME libMaterialXCore.so)
endif()
endif()

find_path(MATERIALX_LIB_DIRS
"${MATERIALX_CORE_STATIC_LIB_NAME}"
"${MATERIALX_CORE_DYNAMIC_LIB_NAME}"
HINTS
"${MATERIALX_ROOT}"
"$ENV{MATERIALX_ROOT}"
"${MATERIALX_BASE_DIR}"
"${MATERIALX_LIB_DIR}"
"$ENV{MATERIALX_LIB_DIR}"
PATH_SUFFIXES
lib
DOC
"MaterialX Library Path"
)

foreach(MATERIALX_LIB
Core
Format
GenGlsl
GenOsl
GenShader
Render
RenderGlsl
RenderHw
RenderOsl
)
find_library(MATERIALX_${MATERIALX_LIB}_LIBRARY
MaterialX${MATERIALX_LIB}
HINTS
"${MATERIALX_LIB_DIRS}"
DOC
"MaterialX's ${MATERIALX_LIB} library path"
NO_CMAKE_SYSTEM_PATH
)

if (MATERIALX_${MATERIALX_LIB}_LIBRARY)
list(APPEND MATERIALX_LIBRARIES ${MATERIALX_${MATERIALX_LIB}_LIBRARY})
endif ()
endforeach()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MaterialX
REQUIRED_VARS
MATERIALX_BASE_DIR
MATERIALX_INCLUDE_DIRS
MATERIALX_LIB_DIRS
MATERIALX_LIBRARIES
)
2 changes: 1 addition & 1 deletion cmake/modules/FindUSD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ endif ()
# Look for the dynamic libraries.
# Right now this is using a hardcoded list of libraries, but in the future we should parse the installed cmake files
# and figure out the list of the names for libraries.
set(USD_LIBS ar;arch;cameraUtil;garch;gf;glf;hd;hdSt;hdx;hf;hgi;hgiGL;hio;js;kind;ndr;pcp;plug;pxOsd;sdf;sdr;tf;trace;usd;usdAppUtils;usdGeom;usdHydra;usdImaging;usdImagingGL;usdLux;usdRender;usdRi;usdShade;usdShaders;usdSkel;usdSkelImaging;usdUI;usdUtils;usdviewq;usdVol;usdVolImaging;vt;work;usd_ms)
set(USD_LIBS ar;arch;cameraUtil;garch;gf;glf;hd;hdMtlx;hdSt;hdx;hf;hgi;hgiGL;hgInterop;hio;js;kind;ndr;pcp;plug;pxOsd;sdf;sdr;tf;trace;usd;usdAppUtils;usdGeom;usdHydra;usdImaging;usdImagingGL;usdLux;usdMedia;usdRender;usdRi;usdRiImaging;usdShade;usdSkel;usdSkelImaging;usdUI;usdUtils;usdviewq;usdVol;usdVolImaging;vt;work;usd_ms)

foreach (lib ${USD_LIBS})
find_library(USD_${lib}_LIBRARY
Expand Down
2 changes: 2 additions & 0 deletions cmake/utils/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ option(BUILD_DOCS "Builds the Documentation" ON)
option(BUILD_TESTSUITE "Builds the testsuite" ON)
option(BUILD_UNIT_TESTS "Build the unit tests" OFF)
option(BUILD_USE_PYTHON3 "Use python 3." OFF)
option(BUILD_ENABLE_MATERIALX_SUPPORT "Enables MaterialX support for USD 21.08 and later." OFF)
option(BUILD_DISABLE_HDMATERIALNETWORK2 "Disables the use of HdMaterialNetwork2 for debugging purposes." ON)

set(PREFIX_PROCEDURAL "procedural" CACHE STRING "Directory to install the procedural under.")
set(PREFIX_PLUGINS "plugin" CACHE STRING "Directory to install the plugins (Hydra and Ndr) under.")
Expand Down
4 changes: 2 additions & 2 deletions cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
set(SRC
main.cpp)
main.cpp)

add_executable(arnold_to_usd ${SRC})
target_link_libraries(arnold_to_usd PRIVATE translator)
target_include_directories(arnold_to_usd PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../translator/writer")

install(TARGETS arnold_to_usd
DESTINATION "${PREFIX_BIN}")
DESTINATION "${PREFIX_BIN}")
38 changes: 0 additions & 38 deletions common/api.h

This file was deleted.

4 changes: 4 additions & 0 deletions common/constant_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ ASTR(AA_sample_clamp_affects_aovs);
ASTR(AA_samples);
ASTR(AA_samples_max);
ASTR(AA_seed);
ASTR(ArnoldUsd);
ASTR(BOOL);
ASTR(BYTE);
ASTR(CPU);
Expand Down Expand Up @@ -285,6 +286,7 @@ ASTR(missing);
ASTR(missing_texture_color);
ASTR(motion_end);
ASTR(motion_start);
ASTR(mtlx);
ASTR(multiply);
ASTR(name);
ASTR(near_clip);
Expand Down Expand Up @@ -343,6 +345,7 @@ ASTR(scale);
ASTR(scope);
ASTR(shade_mode);
ASTR(shader);
ASTR(shader_prefix);
ASTR(shadow);
ASTR(shadow_group);
ASTR(shidxs);
Expand All @@ -366,6 +369,7 @@ ASTR(step_size);
ASTR(subdiv_iterations);
ASTR(subdiv_type);
ASTR(subsurface);
ASTR(surface);
ASTR(swrap);
ASTR(texture_accept_unmipped);
ASTR(texture_accept_untiled);
Expand Down
40 changes: 20 additions & 20 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
set(DOXYGEN_INDEX "${CMAKE_CURRENT_BINARY_DIR}/out/html/index.html")

file(GLOB_RECURSE DELEGATE_HDRS CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/render_delegate/*.h")
"${CMAKE_SOURCE_DIR}/render_delegate/*.h")

file(GLOB_RECURSE NDR_HDRS CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/ndr/*.h")
"${CMAKE_SOURCE_DIR}/ndr/*.h")

file(GLOB_RECURSE TRANSLATOR_HDRS CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/translator/*.h")
"${CMAKE_SOURCE_DIR}/translator/*.h")

add_custom_command(OUTPUT ${DOXYGEN_INDEX}
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/../README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/building.md"
"${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
"${CMAKE_CURRENT_SOURCE_DIR}/conventions.md"
"${CMAKE_CURRENT_SOURCE_DIR}/documenting.md"
"${CMAKE_CURRENT_SOURCE_DIR}/naming_conventions.md"
${DELEGATE_HDRS}
${NDR_HDRS}
${TRANSLATOR_HDRS}
COMMAND ${DOXYGEN_EXECUTABLE} "${DOXYGEN_OUT}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/../README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/building.md"
"${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
"${CMAKE_CURRENT_SOURCE_DIR}/conventions.md"
"${CMAKE_CURRENT_SOURCE_DIR}/documenting.md"
"${CMAKE_CURRENT_SOURCE_DIR}/naming_conventions.md"
${DELEGATE_HDRS}
${NDR_HDRS}
${TRANSLATOR_HDRS}
COMMAND ${DOXYGEN_EXECUTABLE} "${DOXYGEN_OUT}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
add_custom_target(docs_doxygen ALL
DEPENDS
${DOXYGEN_INDEX})
DEPENDS
${DOXYGEN_INDEX})

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/out/html"
DESTINATION docs)
DESTINATION docs)
23 changes: 23 additions & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,29 @@ cmake ..

On windows, it's also an option to use [https://cmake.org/runningcmake/](cmake-gui), instead of the command line.

This example configures arnold-usd using a stock build of USD 20.08 (using the supplied build script), installed at `C:\USD`, with arnold installed at `C:\arnold`, google test installed at `C:\googletest` and a default Python 2.7 installation. USD was built using Visual Studio 2019.

```
cmake ..
-G "Visual Studio 16 2019"
-DCMAKE_INSTALL_PREFIX=C:\arnold-usd
-DCMAKE_CXX_STANDARD=14
-DARNOLD_LOCATION=C:\arnold
-DUSD_INCLUDE_DIR=C:\USD\include
-DUSD_LIBRARY_DIR=C:\USD\lib
-DBUILD_SCHEMAS=OFF
-DBUILD_UNIT_TESTS=ON
-DPython2_ROOT_DIR=C:\Python27
-DBUILD_USE_CUSTOM_BOOST=ON
-DBoost_INCLUDE_DIRS=C:\USD\include\boost-1_70
-DBoost_LIBRARIES=C:\USD\lib\boost_python27-vc142-mt-x64-1_70.lib
-DTBB_FOUND=ON
-DTBB_INCLUDE_DIRS=C:\USD\include
-DTBB_LIBRARIES=C:\USD\lib\tbb.lib
-DGOOGLETEST_LOCATION=C:\googletest
```


This example configures arnold-usd for Houdini 18.0.499 on Windows using the default installation folder, with arnold installed at `C:\arnold`. Note, as of 18.0.499, Houdini lacks inclusion of usdgenschema, so we have to disable generating the custom schemas.

```
Expand Down
Loading

0 comments on commit 198da8f

Please sign in to comment.