[Bf-blender-cvs] [f674176d776] blender-v3.0-release: Fix T85676: Cycles EXR merging not working with some single layer EXRs

Brecht Van Lommel noreply at git.blender.org
Tue Nov 2 21:24:19 CET 2021


Commit: f674176d7765079614d3c326616a98f9e6135207
Author: Brecht Van Lommel
Date:   Tue Nov 2 21:07:37 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBf674176d7765079614d3c326616a98f9e6135207

Fix T85676: Cycles EXR merging not working with some single layer EXRs

If there is only a layer without a name, use metadata from the first cycles
layer in the metadata, if any.

===================================================================

M	intern/cycles/session/merge.cpp

===================================================================

diff --git a/intern/cycles/session/merge.cpp b/intern/cycles/session/merge.cpp
index 5890c15f48c..9044a8c4809 100644
--- a/intern/cycles/session/merge.cpp
+++ b/intern/cycles/session/merge.cpp
@@ -163,8 +163,26 @@ static bool parse_channels(const ImageSpec &in_spec,
     file_layers[layername].passes.push_back(pass);
   }
 
-  /* Loop over all detected render-layers, check whether they contain a full set of input channels.
-   * Any channels that won't be processed internally are also passed through. */
+  /* If file contains a single unnamed layer, name it after the first layer metadata we find. */
+  if (file_layers.size() == 1 && file_layers.find("") != file_layers.end()) {
+    for (const ParamValue &attrib : in_spec.extra_attribs) {
+      const string attrib_name = attrib.name().string();
+      if (string_startswith(attrib_name, "cycles.") && string_endswith(attrib_name, ".samples")) {
+        /* Extract layer name. */
+        const size_t start = strlen("cycles.");
+        const size_t end = attrib_name.size() - strlen(".samples");
+        const string layername = attrib_name.substr(start, end - start);
+
+        /* Reinsert as named instead of unnamed layer. */
+        const MergeImageLayer layer = file_layers[""];
+        file_layers.clear();
+        file_layers[layername] = layer;
+      }
+    }
+  }
+
+  /* Loop over all detected render-layers, check whether they contain a full set of input
+   * channels. Any channels that won't be processed internally are also passed through. */
   for (auto &i : file_layers) {
     const string &name = i.first;
     MergeImageLayer &layer = i.second;



More information about the Bf-blender-cvs mailing list