From 2cd996db55b8129acb1598cf619e4edbda64013f Mon Sep 17 00:00:00 2001 From: bd_ Date: Mon, 5 Aug 2024 21:13:41 -0700 Subject: [PATCH] fix: cursed interaction with Unity Timeline causes animation curves to be lost (#952) Closes: #950 --- Editor/Animation/PathMappings.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Editor/Animation/PathMappings.cs b/Editor/Animation/PathMappings.cs index e57c94a9..7d42126b 100644 --- a/Editor/Animation/PathMappings.cs +++ b/Editor/Animation/PathMappings.cs @@ -196,7 +196,7 @@ namespace nadena.dev.modular_avatar.animation } } - private string MapPath(UnityEditor.EditorCurveBinding binding) + private string MapPath(EditorCurveBinding binding) { if (binding.type == typeof(Animator) && binding.path == "") { @@ -249,7 +249,10 @@ namespace nadena.dev.modular_avatar.animation { var newBinding = binding; newBinding.path = MapPath(binding); - newClip.SetCurve(newBinding.path, newBinding.type, newBinding.propertyName, + // https://github.com/bdunderscore/modular-avatar/issues/950 + // It's reported that sometimes using SetObjectReferenceCurve right after SetCurve might cause the + // curves to be forgotten; use SetEditorCurve instead. + AnimationUtility.SetEditorCurve(newClip, newBinding, AnimationUtility.GetEditorCurve(originalClip, binding)); }