diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-01-12 18:19:54 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-01-12 18:24:26 +0300 |
commit | 957e292c5864cba3cf62c7c59dc644422660034f (patch) | |
tree | b182f75cf4d61dd3401f4dbe59d3ab3df1642897 /source/blender/blenkernel/intern/cryptomatte_test.cc | |
parent | c3b68fa7b1cafa6c4e4b73830597582606082b6d (diff) |
Fix T64953: Add cryptomatte meta data to file output node.
This change will try to add meta data when using a multilayered open
exr file output node in the compositor. It adds the current scene meta
data and converts existing cryptomatte keys so it follows the
naming that is configured in the file output node.
This change supports the basic use-case where the compositor is
used to output cryptomatte layers with a different naming scheme to
support external compositors. In this case the Multilayered OpenEXR
files are used and the meta data is read from the render result.
Meta data is found when render layer node is connected with the
file output node without any other nodes in between. Redirects and empty
node groups are allowed.
The patch has been verified to work with external compositors.
See https://devtalk.blender.org/t/making-sense-of-cryptomatte-usage-in-third-party-programs/16576/17
See patch for example files.
Reviewed By: Sergey Sharybin
Differential Revision: https://developer.blender.org/D10016
Diffstat (limited to 'source/blender/blenkernel/intern/cryptomatte_test.cc')
-rw-r--r-- | source/blender/blenkernel/intern/cryptomatte_test.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/cryptomatte_test.cc b/source/blender/blenkernel/intern/cryptomatte_test.cc new file mode 100644 index 00000000000..3773b2b3bf9 --- /dev/null +++ b/source/blender/blenkernel/intern/cryptomatte_test.cc @@ -0,0 +1,44 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2021 by Blender Foundation. + */ +#include "testing/testing.h" + +#include "BKE_cryptomatte.hh" + +namespace blender::bke::tests { + +TEST(cryptomatte, meta_data_key) +{ + ASSERT_EQ("cryptomatte/c7dbf5e/key", + BKE_cryptomatte_meta_data_key("ViewLayer.CryptoMaterial", "key")); + ASSERT_EQ("cryptomatte/b990b65/𝓴𝓮𝔂", + BKE_cryptomatte_meta_data_key("𝖚𝖓𝖎𝖈𝖔𝖉𝖊.CryptoMaterial", "𝓴𝓮𝔂")); +} + +TEST(cryptomatte, extract_layer_name) +{ + ASSERT_EQ("ViewLayer.CryptoMaterial", + BKE_cryptomatte_extract_layer_name("ViewLayer.CryptoMaterial00")); + ASSERT_EQ("𝖚𝖓𝖎𝖈𝖔𝖉𝖊", BKE_cryptomatte_extract_layer_name("𝖚𝖓𝖎𝖈𝖔𝖉𝖊13")); + ASSERT_EQ("NoTrailingSampleNumber", + BKE_cryptomatte_extract_layer_name("NoTrailingSampleNumber")); + ASSERT_EQ("W1thM1dd13Numb3rs", BKE_cryptomatte_extract_layer_name("W1thM1dd13Numb3rs09")); + ASSERT_EQ("", BKE_cryptomatte_extract_layer_name("0123")); + ASSERT_EQ("", BKE_cryptomatte_extract_layer_name("")); +} + +} // namespace blender::bke::tests |