From 5b52ad45c1cec49f7cd7fb3d843b8380088800ba Mon Sep 17 00:00:00 2001 From: bd_ Date: Mon, 29 Aug 2022 14:00:40 -0700 Subject: [PATCH] Don't remap references to the animator itself --- .../Editor/AnimatorMerger.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs b/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs index 92197702..984454dc 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs @@ -93,6 +93,18 @@ namespace net.fushizen.modular_avatar.core.editor return asm; } + private static string MapPath(EditorCurveBinding binding, string basePath) + { + if (binding.type == typeof(Animator) && binding.path == "") + { + return ""; + } + else + { + return PathMappings.MapPath(basePath + binding.path); + } + } + private Object customClone(Object o, string basePath) { if (basePath == "") return null; @@ -106,7 +118,7 @@ namespace net.fushizen.modular_avatar.core.editor foreach (var binding in AnimationUtility.GetCurveBindings(clip)) { var newBinding = binding; - newBinding.path = PathMappings.MapPath(basePath + binding.path); + newBinding.path = MapPath(binding, basePath); newClip.SetCurve(newBinding.path, newBinding.type, newBinding.propertyName, AnimationUtility.GetEditorCurve(clip, binding)); } @@ -114,7 +126,7 @@ namespace net.fushizen.modular_avatar.core.editor foreach (var objBinding in AnimationUtility.GetObjectReferenceCurveBindings(clip)) { var newBinding = objBinding; - newBinding.path = PathMappings.MapPath(basePath + objBinding.path); + newBinding.path = MapPath(objBinding, basePath); AnimationUtility.SetObjectReferenceCurve(newClip, newBinding, AnimationUtility.GetObjectReferenceCurve(clip, objBinding)); }