diff --git a/libraries/bxdf/usd_preview_surface.mtlx b/libraries/bxdf/usd_preview_surface.mtlx
index f89e561c3d..3fdd429dfb 100644
--- a/libraries/bxdf/usd_preview_surface.mtlx
+++ b/libraries/bxdf/usd_preview_surface.mtlx
@@ -25,6 +25,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -112,8 +131,11 @@
+
+
+
-
+
diff --git a/resources/Materials/Examples/UsdPreviewSurface/usd_preview_surface_presence.mtlx b/resources/Materials/Examples/UsdPreviewSurface/usd_preview_surface_presence.mtlx
new file mode 100644
index 0000000000..e3e03a5659
--- /dev/null
+++ b/resources/Materials/Examples/UsdPreviewSurface/usd_preview_surface_presence.mtlx
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MaterialXCore/Element.cpp b/source/MaterialXCore/Element.cpp
index a074277aca..08cb41d270 100644
--- a/source/MaterialXCore/Element.cpp
+++ b/source/MaterialXCore/Element.cpp
@@ -827,7 +827,18 @@ bool ValueElement::validate(string* message) const
validateRequire(valueElem != nullptr, res, message, "Interface name not found in referenced declaration");
if (valueElem)
{
- validateRequire(getType() == valueElem->getType(), res, message, "Interface name refers to value element of a different type");
+ bool typesMatch = getType() == valueElem->getType();
+ if (!typesMatch)
+ {
+ // if the types don't match - we might have an enumeration at the interface.
+ if (valueElem->getType() == STRING_TYPE_STRING &&
+ getType() == INTEGER_TYPE_STRING &&
+ valueElem->hasAttribute(ValueElement::ENUM_ATTRIBUTE))
+ {
+ typesMatch = true;
+ }
+ }
+ validateRequire(typesMatch, res, message, "Interface name refers to value element of a different type");
}
}
}
diff --git a/source/MaterialXCore/Types.cpp b/source/MaterialXCore/Types.cpp
index 4b34e49295..3985d18505 100644
--- a/source/MaterialXCore/Types.cpp
+++ b/source/MaterialXCore/Types.cpp
@@ -11,6 +11,7 @@ const string DEFAULT_TYPE_STRING = "color3";
const string FILENAME_TYPE_STRING = "filename";
const string GEOMNAME_TYPE_STRING = "geomname";
const string STRING_TYPE_STRING = "string";
+const string INTEGER_TYPE_STRING = "integer";
const string BSDF_TYPE_STRING = "BSDF";
const string EDF_TYPE_STRING = "EDF";
const string VDF_TYPE_STRING = "VDF";
diff --git a/source/MaterialXCore/Types.h b/source/MaterialXCore/Types.h
index 4fd88cb127..ea684cef36 100644
--- a/source/MaterialXCore/Types.h
+++ b/source/MaterialXCore/Types.h
@@ -22,6 +22,7 @@ extern MX_CORE_API const string DEFAULT_TYPE_STRING;
extern MX_CORE_API const string FILENAME_TYPE_STRING;
extern MX_CORE_API const string GEOMNAME_TYPE_STRING;
extern MX_CORE_API const string STRING_TYPE_STRING;
+extern MX_CORE_API const string INTEGER_TYPE_STRING;
extern MX_CORE_API const string BSDF_TYPE_STRING;
extern MX_CORE_API const string EDF_TYPE_STRING;
extern MX_CORE_API const string VDF_TYPE_STRING;