From d4458f58b4697e546ab727765b9520d5aa45f1f3 Mon Sep 17 00:00:00 2001 From: Jonah Friedman Date: Wed, 26 Sep 2018 11:49:56 -0400 Subject: [PATCH] refactored write_array_of_AOVs, renamed to aov_array_set_flt --- cryptomatte/cryptomatte.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cryptomatte/cryptomatte.h b/cryptomatte/cryptomatte.h index ffc2f51..af22ad1 100644 --- a/cryptomatte/cryptomatte.h +++ b/cryptomatte/cryptomatte.h @@ -944,11 +944,11 @@ struct CryptomatteData { hash_object_rgb(sg, nsp_hash_clr, obj_hash_clr, mat_hash_clr); if (aov_array_cryptoasset) - write_array_of_AOVs(sg, aov_array_cryptoasset, nsp_hash_clr.r); + aov_array_set_flt(sg, aov_array_cryptoasset, nsp_hash_clr.r); if (aov_array_cryptoobject) - write_array_of_AOVs(sg, aov_array_cryptoobject, obj_hash_clr.r); + aov_array_set_flt(sg, aov_array_cryptoobject, obj_hash_clr.r); if (aov_array_cryptomaterial) - write_array_of_AOVs(sg, aov_array_cryptomaterial, mat_hash_clr.r); + aov_array_set_flt(sg, aov_array_cryptomaterial, mat_hash_clr.r); nsp_hash_clr.r = obj_hash_clr.r = mat_hash_clr.r = 0.0f; @@ -970,7 +970,7 @@ struct CryptomatteData { if (!result.empty()) hash = hash_name_rgb(result.c_str()); - write_array_of_AOVs(sg, aovArray, hash.r); + aov_array_set_flt(sg, aovArray, hash.r); hash.r = 0.0f; AiAOVSetRGBA(sg, aov_name, hash); } @@ -1020,6 +1020,15 @@ struct CryptomatteData { } } + void aov_array_set_flt(AtShaderGlobals* sg, const AtArray* aov_names, float id) const { + for (uint32_t i = 0; i < AiArrayGetNumElements(aov_names); i++) { + const AtString aov_name = AiArrayGetStr(aov_names, i); + if (aov_name.empty()) + return; + AiAOVSetFlt(sg, aov_name, id); + } + } + /////////////////////////////////////////////// // Building Cryptomatte Arnold Nodes /////////////////////////////////////////////// @@ -1257,15 +1266,6 @@ struct CryptomatteData { return aovs; } - void write_array_of_AOVs(AtShaderGlobals* sg, const AtArray* names, float id) const { - for (uint32_t i = 0; i < AiArrayGetNumElements(names); i++) { - AtString aovName = AiArrayGetStr(names, i); - if (aovName.empty()) - return; - AiAOVSetFlt(sg, aovName, id); - } - } - AtNode* setup_manifest_driver() { AtString manifest_driver_name("cryptomatte_manifest_driver"); AtNode* manifest_driver = AiNodeLookUpByName(manifest_driver_name);