Files
test/build_files/build_environment/patches/usd_3243.diff
Ray Molenkamp 1540817576 For VFX platform 2025 and more.
Boost (removed!)
Cython 3.0.11
Expat 2.6.4
GMP 6.3.0
MaterialX 1.39.2
Nanobind 2.1.0 (new, for OpenVDB)
NumPy 1.26.4
OpenColorIO 2.4.1
OpenEXR 3.3.2
OpenImageIO 3.0.3.1
OpenVDB 12.0.0
OSL 1.14.3-beta
Python 3.11.11
Robinmap 1.3.0
TBB 2021.13.0
TIFF 4.7.0
USD 25.02
libxml2 2.13.5
zlib 1.3.1

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Jonas Holzman <jonas@holzman.fr>
Co-authored-by: Sebastian Parborg <sebastian@blender.org>

Ref #128577

Pull Request: https://projects.blender.org/blender/blender/pulls/134178
2025-02-06 14:57:02 +01:00

71 lines
2.4 KiB
Diff

diff --git a/pxr/usd/usdMtlx/reader.cpp b/pxr/usd/usdMtlx/reader.cpp
index f04ab07ac1..aa4d1e65de 100644
--- a/pxr/usd/usdMtlx/reader.cpp
+++ b/pxr/usd/usdMtlx/reader.cpp
@@ -9,6 +9,7 @@
#include "pxr/usd/usdMtlx/reader.h"
#include "pxr/usd/usdMtlx/utils.h"
+#include "pxr/usd/usdGeom/metrics.h"
#include "pxr/usd/usdGeom/primvar.h"
#include "pxr/usd/usdGeom/primvarsAPI.h"
#include "pxr/usd/usdShade/material.h"
@@ -740,11 +741,11 @@ _NodeGraphBuilder::Build(ShaderNamesByOutputName* outputs)
return UsdPrim();
}
- const bool isInsideNodeGraph = _mtlxContainer->isA<mx::NodeGraph>();
+ const bool isExplicitNodeGraph = _mtlxContainer->isA<mx::NodeGraph>();
// Create the USD nodegraph.
UsdPrim usdPrim;
- if (isInsideNodeGraph) {
+ if (isExplicitNodeGraph) {
// Create the nodegraph.
auto usdNodeGraph = UsdShadeNodeGraph::Define(_usdStage, _usdPath);
if (!usdNodeGraph) {
@@ -769,7 +770,7 @@ _NodeGraphBuilder::Build(ShaderNamesByOutputName* outputs)
}
}
else {
- usdPrim = _usdStage->DefinePrim(_usdPath);
+ usdPrim = UsdShadeNodeGraph::Define(_usdStage, _usdPath).GetPrim();
}
// Build the graph of nodes.
@@ -783,19 +784,7 @@ _NodeGraphBuilder::Build(ShaderNamesByOutputName* outputs)
_AddNode(mtlxNode, usdPrim);
}
_ConnectNodes();
-
- if (isInsideNodeGraph) {
- _ConnectTerminals(_mtlxContainer, UsdShadeConnectableAPI(usdPrim));
- }
- else if (outputs) {
- // Collect the outputs on the existing shader nodes.
- for (mx::OutputPtr& mtlxOutput :
- _mtlxContainer->getChildrenOfType<mx::Output>()) {
- if (auto nodeName = _Attr(mtlxOutput, names.nodename)) {
- (*outputs)[_Name(mtlxOutput)] = TfToken(nodeName);
- }
- }
- }
+ _ConnectTerminals(_mtlxContainer, UsdShadeConnectableAPI(usdPrim));
return usdPrim;
}
@@ -2623,6 +2612,13 @@ UsdMtlxRead(
// Translate all materials.
ReadMaterials(mtlxDoc, context);
+ if (!mtlxDoc->getChildren().empty()) {
+ // This metadata is required to pass usdchecker
+ UsdGeomSetStageUpAxis(stage, UsdGeomGetFallbackUpAxis());
+ UsdGeomSetStageMetersPerUnit(stage, UsdGeomLinearUnits::centimeters);
+ stage->SetDefaultPrim(stage->GetPrimAtPath(internalPath));
+ }
+
// If there are no looks then we're done.
if (mtlxDoc->getLooks().empty()) {
return;