From 153a803c46181319fd782ef8426ff58a2e885d82 Mon Sep 17 00:00:00 2001 From: krohmerNV <42233792+krohmerNV@users.noreply.github.com> Date: Sat, 17 Aug 2024 05:31:09 +0200 Subject: [PATCH] Fix combine2 implementation in MDL (#1975) Fix a regression after this [commit](https://github.com/AcademySoftwareFoundation/MaterialX/commit/4713ec9ff9edcc33e6ec663e7d4c35e3ce68e385#diff-0bae9161e30f26f13ee964c3007c7f13d51d971da82c9fab4184cda13e26400c). Add a custom implementation for combine2(color, float) because the index access is not allowed on the MDL color type. --- libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx | 2 +- source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl | 6 ++++++ source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx index ec4af76961..51566463aa 100644 --- a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx +++ b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx @@ -686,7 +686,7 @@ - + diff --git a/source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl b/source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl index 8cfedd56a0..601a10fda2 100644 --- a/source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl +++ b/source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl @@ -4437,3 +4437,9 @@ export float3 mx_worleynoise3d_float3( { return noise::mx_worley_noise_float3(mxp_position, mxp_jitter, 0); } + +export core::color4 mx_combine2_color4CF(color in1, float in2) +{ + float3 in1_as_float3 = float3(in1); + return core::mk_color4(in1_as_float3.x, in1_as_float3.y, in1_as_float3.z, in2); +} diff --git a/source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl b/source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl index b6e7174114..bef1e430d4 100644 --- a/source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl +++ b/source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl @@ -321,6 +321,7 @@ export using .::stdlib_1_7 import mx_worleynoise2d_float3; export using .::stdlib_1_7 import mx_worleynoise3d_float; export using .::stdlib_1_7 import mx_worleynoise3d_float2; export using .::stdlib_1_7 import mx_worleynoise3d_float3; +export using .::stdlib_1_7 import mx_combine2_color4CF; // NOTE: Not planned to be implemented. export using .::stdlib_1_7 import mx_geompropvalue_string;