From fdac4aeec527ae3a19fa3ae10a62cbff69e0d91b Mon Sep 17 00:00:00 2001 From: Narazaka Date: Mon, 18 Mar 2024 00:13:30 +0900 Subject: [PATCH 1/3] ContactParameterProvider ParameterType --- .../VRChatProviders/ContactParameterProvider.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Editor/VRChat/ParameterIntrospection/VRChatProviders/ContactParameterProvider.cs b/Editor/VRChat/ParameterIntrospection/VRChatProviders/ContactParameterProvider.cs index b2721d5..6b57bfa 100644 --- a/Editor/VRChat/ParameterIntrospection/VRChatProviders/ContactParameterProvider.cs +++ b/Editor/VRChat/ParameterIntrospection/VRChatProviders/ContactParameterProvider.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.Collections.Immutable; using VRC.SDK3.Dynamics.Contact.Components; +using VRC.Dynamics; +using UnityEngine; #endregion @@ -26,7 +28,7 @@ public IEnumerable GetSuppliedParameters(BuildContext context return new[] { new ProvidedParameter(_component.parameter, ParameterNamespace.Animator, _component, - VRChatBuiltinProviderPlugin.Instance, null) + VRChatBuiltinProviderPlugin.Instance, _component.receiverType == ContactReceiver.ReceiverType.Proximity ? AnimatorControllerParameterType.Float : AnimatorControllerParameterType.Bool) { IsAnimatorOnly = true, WantSynced = false, @@ -40,4 +42,4 @@ public IEnumerable GetSuppliedParameters(BuildContext context // no-op } } -} \ No newline at end of file +} From f5bd84d82636459ec96954365bfcc7f6204091f7 Mon Sep 17 00:00:00 2001 From: Narazaka Date: Mon, 25 Mar 2024 21:44:18 +0900 Subject: [PATCH 2/3] test --- .../ParameterIntrospection/VRChatBindingsTest.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/UnitTests~/ParameterIntrospection/VRChatBindingsTest.cs b/UnitTests~/ParameterIntrospection/VRChatBindingsTest.cs index b222e22..5e7607b 100644 --- a/UnitTests~/ParameterIntrospection/VRChatBindingsTest.cs +++ b/UnitTests~/ParameterIntrospection/VRChatBindingsTest.cs @@ -4,6 +4,7 @@ using nadena.dev.ndmf; using NUnit.Framework; using UnityEngine; +using VRC.Dynamics; using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Dynamics.Contact.Components; @@ -78,10 +79,12 @@ public void VRCParams() Assert.AreEqual(1, parameters["syncedBool"].BitUsage); Assert.AreEqual(ParameterNamespace.Animator, parameters["syncedBool"].Namespace); Assert.IsTrue(parameters["syncedBool"].WantSynced); - } - - [Test] - public void TestContact() + } + + [TestCase(ContactReceiver.ReceiverType.Constant, AnimatorControllerParameterType.Bool)] + [TestCase(ContactReceiver.ReceiverType.OnEnter, AnimatorControllerParameterType.Bool)] + [TestCase(ContactReceiver.ReceiverType.Proximity, AnimatorControllerParameterType.Float)] + public void TestContact(ContactReceiver.ReceiverType receiverType, AnimatorControllerParameterType parameterType) { var root = CreateRoot("avatar"); var desc = root.GetComponent(); @@ -89,6 +92,7 @@ public void TestContact() var obj = CreateChild(root, "foo"); var contact = obj.AddComponent(); + contact.receiverType = receiverType; var parameters = ParameterInfo.ForUI.GetParametersForObject(obj) .ToImmutableDictionary(p => p.EffectiveName, p => p); @@ -100,7 +104,7 @@ public void TestContact() Assert.AreEqual(1, parameters.Count); var param = parameters["abc"]; - Assert.AreEqual(null, param.ParameterType); + Assert.AreEqual(parameterType, param.ParameterType); Assert.AreEqual(0, param.BitUsage); Assert.AreEqual(ParameterNamespace.Animator, param.Namespace); Assert.IsFalse(param.WantSynced); From 9f066ca3504bf97c88de51012e8669ff8f6306c8 Mon Sep 17 00:00:00 2001 From: Narazaka Date: Mon, 25 Mar 2024 21:51:36 +0900 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cdaa33..4a7ceb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Specify zh-* font to make the font normal ### Changed +- In ParameterProvider, the parameter type of PhysBone Contact Receiver is now the type corresponding to the receiver type. (#209) ### Removed