diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt index f0c226c316ec19e100905f164725261d7b559168..0178804629202a3de1200d38c64e3a1cdfde1ad6 100644 --- a/source/blender/nodes/shader/CMakeLists.txt +++ b/source/blender/nodes/shader/CMakeLists.txt @@ -139,10 +139,6 @@ set(LIB if(WITH_MATERIALX) add_definitions(-DWITH_MATERIALX) - list(APPEND INC - ${USD_INCLUDE_DIRS} - ${BOOST_INCLUDE_DIR} - ) list(APPEND SRC materialx/material.cc materialx/node_item.cc @@ -158,6 +154,14 @@ if(WITH_MATERIALX) MaterialXCore MaterialXFormat ) + + if(WITH_USD) + add_definitions(-DWITH_USD) + list(APPEND INC_SYS + ${USD_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIR} + ) + endif() endif() if(WITH_FREESTYLE) diff --git a/source/blender/nodes/shader/materialx/node_parser.cc b/source/blender/nodes/shader/materialx/node_parser.cc index c0f3ec1064adff2c595873c6af81c4a27bf70598..b55001132e9d14b6bb6c924424e3380bd49110ce 100644 --- a/source/blender/nodes/shader/materialx/node_parser.cc +++ b/source/blender/nodes/shader/materialx/node_parser.cc @@ -2,7 +2,9 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include <pxr/base/tf/stringUtils.h> +#ifdef WITH_USD +# include <pxr/base/tf/stringUtils.h> +#endif #include "node_parser.h" @@ -63,9 +65,13 @@ NodeItem NodeParser::compute_full() std::string NodeParser::node_name(bool with_out_socket) const { auto valid_name = [](const std::string &name) { +#ifdef WITH_USD /* Node name should suite to MatX and USD valid names. * It shouldn't start from '_', due to error occured in Storm delegate. */ std::string res = MaterialX::createValidName(pxr::TfMakeValidIdentifier(name)); +#else + std::string res = MaterialX::createValidName(name); +#endif if (res[0] == '_') { res = "node" + res; }