diff --git a/resources/Materials/TestSuite/stdlib/upgrade/1_38_parameter_to_input.mtlx b/resources/Materials/TestSuite/stdlib/upgrade/1_38_parameter_to_input.mtlx
index b44b473fd4..e757dddd13 100644
--- a/resources/Materials/TestSuite/stdlib/upgrade/1_38_parameter_to_input.mtlx
+++ b/resources/Materials/TestSuite/stdlib/upgrade/1_38_parameter_to_input.mtlx
@@ -72,8 +72,25 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MaterialXView/CMakeLists.txt b/source/MaterialXView/CMakeLists.txt
index ead0c7d8c8..2ca79125af 100644
--- a/source/MaterialXView/CMakeLists.txt
+++ b/source/MaterialXView/CMakeLists.txt
@@ -74,6 +74,9 @@ endif()
if (MATERIALX_BUILD_GEN_MDL)
LIST(APPEND LIBS MaterialXGenMdl)
endif()
+if (MATERIALX_BUILD_GEN_ARNOLD)
+ LIST(APPEND LIBS MaterialXGenArnold)
+endif()
target_link_libraries(
${LIBS}
diff --git a/source/MaterialXView/Viewer.cpp b/source/MaterialXView/Viewer.cpp
index 62cf6d2b99..03aaa1b772 100644
--- a/source/MaterialXView/Viewer.cpp
+++ b/source/MaterialXView/Viewer.cpp
@@ -14,6 +14,9 @@
#include
#include
+#ifdef MATERIALX_BUILD_GEN_ARNOLD
+#include
+#endif
#include
#include
@@ -229,6 +232,9 @@ Viewer::Viewer(const std::string& materialFilename,
#endif
#if MATERIALX_BUILD_GEN_MDL
_genContextMdl(mx::MdlShaderGenerator::create()),
+#endif
+#if MATERIALX_BUILD_GEN_ARNOLD
+ _genContextArnold(mx::ArnoldShaderGenerator::create()),
#endif
_unitRegistry(mx::UnitConverterRegistry::create()),
_splitByUdims(true),
@@ -1395,6 +1401,14 @@ void Viewer::saveShaderSource(mx::GenContext& context)
writeTextFile(pixelShader, baseName + ".mdl");
new ng::MessageDialog(this, ng::MessageDialog::Type::Information, "Saved MDL source: ", baseName);
}
+#endif
+#if MATERIALX_BUILD_GEN_ARNOLD
+ else if (context.getShaderGenerator().getTarget() == mx::ArnoldShaderGenerator::TARGET)
+ {
+ const std::string& pixelShader = shader->getSourceCode(mx::Stage::PIXEL);
+ writeTextFile(pixelShader, baseName + "_arnold.osl");
+ new ng::MessageDialog(this, ng::MessageDialog::Type::Information, "Saved Arnold OSL source: ", baseName);
+ }
#endif
}
}
@@ -1532,6 +1546,9 @@ void Viewer::loadStandardLibraries()
#if MATERIALX_BUILD_GEN_MDL
initContext(_genContextMdl);
#endif
+#if MATERIALX_BUILD_GEN_ARNOLD
+ initContext(_genContextArnold);
+#endif
}
bool Viewer::keyboardEvent(int key, int scancode, int action, int modifiers)
@@ -1594,6 +1611,15 @@ bool Viewer::keyboardEvent(int key, int scancode, int action, int modifiers)
}
#endif
+#if MATERIALX_BUILD_GEN_ARNOLD
+ // Save MDL shader source to file.
+ if (key == GLFW_KEY_A && action == GLFW_PRESS)
+ {
+ saveShaderSource(_genContextArnold);
+ return true;
+ }
+#endif
+
// Load shader source from file. Editing the source files before loading
// provides a way to debug and experiment with shader source code.
if (key == GLFW_KEY_L && action == GLFW_PRESS)
diff --git a/source/MaterialXView/Viewer.h b/source/MaterialXView/Viewer.h
index 2c0e76466d..25117804e4 100644
--- a/source/MaterialXView/Viewer.h
+++ b/source/MaterialXView/Viewer.h
@@ -302,6 +302,9 @@ class Viewer : public ng::Screen
#if MATERIALX_BUILD_GEN_MDL
mx::GenContext _genContextMdl;
#endif
+#if MATERIALX_BUILD_GEN_ARNOLD
+ mx::GenContext _genContextArnold;
+#endif
// Unit registry
mx::UnitConverterRegistryPtr _unitRegistry;