From cbc2e689675196c17e376e42dc88867800766ff4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 7 Sep 2021 14:08:54 +0900 Subject: [PATCH] ContainsKey --- .../Expression/MaterialValueBindingMerger.cs | 11 +++++++---- Assets/VRM10/Tests/ExpressionTests.cs | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Assets/VRM10/Runtime/Components/Expression/MaterialValueBindingMerger.cs b/Assets/VRM10/Runtime/Components/Expression/MaterialValueBindingMerger.cs index 91be2fb2b..f1d8218a0 100644 --- a/Assets/VRM10/Runtime/Components/Expression/MaterialValueBindingMerger.cs +++ b/Assets/VRM10/Runtime/Components/Expression/MaterialValueBindingMerger.cs @@ -80,11 +80,14 @@ namespace UniVRM10 m_materialMap.Add(binding.MaterialName, item); } var propName = GetProperty(binding.BindType); - item.PropMap.Add(binding.BindType, new PropItem + if (!item.PropMap.ContainsKey(binding.BindType)) { - Name = propName, - DefaultValues = item.Material.GetVector(propName), - }); + item.PropMap.Add(binding.BindType, new PropItem + { + Name = propName, + DefaultValues = item.Material.GetVector(propName), + }); + } } foreach (var binding in kv.Value.MaterialUVBindings) diff --git a/Assets/VRM10/Tests/ExpressionTests.cs b/Assets/VRM10/Tests/ExpressionTests.cs index a7d617f52..c85838a37 100644 --- a/Assets/VRM10/Tests/ExpressionTests.cs +++ b/Assets/VRM10/Tests/ExpressionTests.cs @@ -56,6 +56,7 @@ namespace UniVRM10.Test }); controller.Vrm.Expression.Aa.MaterialColorBindings = src.ToArray(); + // ok if no exception var r = new VRM10ControllerRuntime(controller); } }