From cf5be88e7f75396ab35166cfc7769a83b9de86e5 Mon Sep 17 00:00:00 2001 From: Habib Gahbiche Date: Mon, 28 Jul 2025 10:27:44 +0200 Subject: [PATCH] Fix #143291: USD: World uses wrong output node The problem was that the first output node was chosen instead of the active one. Pull Request: https://projects.blender.org/blender/blender/pulls/143292 --- source/blender/io/usd/intern/usd_light_convert.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/io/usd/intern/usd_light_convert.cc b/source/blender/io/usd/intern/usd_light_convert.cc index 544d786fb05..91a84c38a1f 100644 --- a/source/blender/io/usd/intern/usd_light_convert.cc +++ b/source/blender/io/usd/intern/usd_light_convert.cc @@ -235,10 +235,16 @@ void world_material_to_dome_light(const USDExportParams ¶ms, if (scene->world->use_nodes && scene->world->nodetree) { /* Find the world output. */ + bNode *output = nullptr; const bNodeTree *ntree = scene->world->nodetree; ntree->ensure_topology_cache(); const Span bsdf_nodes = ntree->nodes_by_type("ShaderNodeOutputWorld"); - const bNode *output = bsdf_nodes.is_empty() ? nullptr : bsdf_nodes.first(); + for (const bNode *node : bsdf_nodes) { + if (node->flag & NODE_DO_OUTPUT) { + output = const_cast(node); + break; + } + } if (!output) { /* No output, no valid network to convert. */