Skip to content

Commit 12010b9

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into python_image_loader_fix
2 parents f034f44 + bf12e61 commit 12010b9

6 files changed

Lines changed: 20 additions & 26 deletions

File tree

source/MaterialXFormat/File.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ FilePathVec FilePath::getFilesInDirectory(const string& extension) const
185185

186186
#if defined(_WIN32)
187187
WIN32_FIND_DATAA fd;
188-
FilePath query = extension.empty() ? *this : (*this / ("*." + extension));
188+
FilePath query = extension.empty() ? (*this / "*") : (*this / ("*." + extension));
189189
HANDLE hFind = FindFirstFileA(query.asString().c_str(), &fd);
190190
if (hFind != INVALID_HANDLE_VALUE)
191191
{

source/MaterialXGenOsl/CMakeLists.txt

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
file(GLOB_RECURSE materialx_source
2-
"${CMAKE_CURRENT_SOURCE_DIR}/OslShaderGenerator.cpp"
3-
"${CMAKE_CURRENT_SOURCE_DIR}/OslSyntax.cpp"
4-
"${CMAKE_CURRENT_SOURCE_DIR}/OslNetworkShaderGenerator.cpp"
5-
"${CMAKE_CURRENT_SOURCE_DIR}/OslNetworkSyntax.cpp"
6-
"${CMAKE_CURRENT_SOURCE_DIR}/Nodes/OsoNode.cpp")
7-
8-
file(GLOB_RECURSE materialx_headers
9-
"${CMAKE_CURRENT_SOURCE_DIR}/OslShaderGenerator.h"
10-
"${CMAKE_CURRENT_SOURCE_DIR}/OslSyntax.h"
11-
"${CMAKE_CURRENT_SOURCE_DIR}/OslNetworkShaderGenerator.h"
12-
"${CMAKE_CURRENT_SOURCE_DIR}/OslNetworkSyntax.h"
13-
"${CMAKE_CURRENT_SOURCE_DIR}/Nodes/OsoNode.h"
14-
"${CMAKE_CURRENT_SOURCE_DIR}/Export.h")
1+
file(GLOB_RECURSE materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
2+
file(GLOB_RECURSE materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h*")
3+
4+
list(REMOVE_ITEM materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/LibsToOso.cpp")
155

166
mx_add_library(MaterialXGenOsl
177
SOURCE_FILES
@@ -25,7 +15,7 @@ mx_add_library(MaterialXGenOsl
2515
MATERIALX_GENOSL_EXPORTS)
2616

2717
# FIXME: LibsToOso has a dependency on the OslRenderer.
28-
if (MATERIALX_BUILD_RENDER)
18+
if (MATERIALX_BUILD_OSOS AND MATERIALX_BUILD_RENDER)
2919
file(GLOB GenNodes_SRC "${CMAKE_CURRENT_SOURCE_DIR}/LibsToOso.cpp")
3020

3121
set(MATERIALX_LIBRARIES

source/MaterialXGenOsl/LibsToOso.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ int main(int argc, char* const argv[])
335335
mx::NodeGraphPtr librariesDocGraph = librariesDoc->addNodeGraph("librariesDocGraph");
336336

337337
// Loop over all the `NodeDef` gathered in our documents from the provided libraries.
338-
for (const mx::NodeDefPtr& nodeDef : librariesDoc->getNodeDefs())
338+
for (mx::NodeDefPtr nodeDef : librariesDoc->getNodeDefs())
339339
{
340340
std::string nodeName = nodeDef->getName();
341341

@@ -364,7 +364,7 @@ int main(int argc, char* const argv[])
364364
}
365365

366366
// TODO: Check for the existence/validity of the `Node`?
367-
mx::NodePtr node = librariesDoc->addNodeInstance(nodeDef, nodeName);
367+
mx::NodePtr node = librariesDocGraph->addNodeInstance(nodeDef, nodeName);
368368

369369
std::string oslShaderName = node->getName();
370370
oslShaderGen->getSyntax().makeValidName(oslShaderName);

source/MaterialXRenderOsl/OslRenderer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ OslRendererPtr OslRenderer::create(unsigned int width, unsigned int height, Imag
2828
OslRenderer::OslRenderer(unsigned int width, unsigned int height, Image::BaseType baseType) :
2929
ShaderRenderer(width, height, baseType),
3030
_useTestRender(true),
31+
_useOSLCmdStr(false),
3132
_raysPerPixelLit(1),
3233
_raysPerPixelUnlit(1)
3334
{

source/MaterialXTest/MaterialXFormat/File.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,23 @@ TEST_CASE("Get all files in directory", "[file]")
185185
mx::FilePathVec results;
186186

187187
results = lightsDir.getFilesInDirectory("mtlx");
188-
for (const mx::FilePath& filename : results)
188+
REQUIRE(results.size() > 0);
189+
for (const mx::FilePath& filename : mtlxFilenames)
189190
{
190-
REQUIRE(std::find(mtlxFilenames.begin(), mtlxFilenames.end(), filename) != mtlxFilenames.end());
191+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
191192
}
192193

193194
results = lightsDir.getFilesInDirectory("hdr");
194-
for (const mx::FilePath& filename : results)
195+
REQUIRE(results.size() > 0);
196+
for (const mx::FilePath& filename : hdrFilenames)
195197
{
196-
REQUIRE(std::find(hdrFilenames.begin(), hdrFilenames.end(), filename) != hdrFilenames.end());
198+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
197199
}
198200

199201
results = lightsDir.getFilesInDirectory();
200-
for (const mx::FilePath& filename : results)
202+
REQUIRE(results.size() > 0);
203+
for (const mx::FilePath& filename : allFilesnames)
201204
{
202-
REQUIRE(std::find(allFilesnames.begin(), allFilesnames.end(), filename) != allFilesnames.end());
205+
REQUIRE(std::find(results.begin(), results.end(), filename) != results.end());
203206
}
204207
}

source/MaterialXTest/MaterialXRenderMsl/RenderMsl.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ bool runRenderer(const std::string& shaderName,
165165
std::ostream& log,
166166
const GenShaderUtil::TestSuiteOptions& testOptions,
167167
RenderUtil::RenderProfileTimes& profileTimes,
168-
const mx::FileSearchPath& /*imageSearchPath*/,
168+
const mx::FileSearchPath& imageSearchPath,
169169
const std::string& outputPath,
170170
mx::ImageVec* imageVec)
171171
{
@@ -351,7 +351,7 @@ bool runRenderer(const std::string& shaderName,
351351

352352
{
353353
mx::ScopedTimer renderTimer(&profileTimes.languageTimes.renderTime);
354-
_renderer->getImageHandler()->setSearchPath(mx::getDefaultDataSearchPath());
354+
_renderer->getImageHandler()->setSearchPath(imageSearchPath);
355355
unsigned int width = (unsigned int) testOptions.renderSize[0] * supersampleFactor;
356356
unsigned int height = (unsigned int) testOptions.renderSize[1] * supersampleFactor;
357357
_renderer->setSize(width, height);

0 commit comments

Comments
 (0)