From 54d4e974db9088e629b172edc5411bfcf5d7b094 Mon Sep 17 00:00:00 2001 From: bd_ Date: Mon, 12 Feb 2024 19:35:11 +0900 Subject: [PATCH] feat: convert animator parameters to float when types are inconsistent (#662) --- Editor/Animation/AnimatorCombiner.cs | 211 +++- Editor/MergeAnimatorProcessor.cs | 14 + UnitTests~/Animation/LayerPruningTest.cs | 2 +- UnitTests~/Animation/MergeBlendTreeTest.cs | 4 +- UnitTests~/Animation/MergeOrderTest.cs | 5 +- UnitTests~/MergeAnimatorTests.meta | 8 + .../MergeAnimatorTests/TypeAdjustment.meta | 8 + .../TypeAdjustment/ConvertTransitionTypes.cs | 229 ++++ .../ConvertTransitionTypes.cs.meta | 11 + .../ConvertTransitionTypes.prefab | 431 +++++++ .../ConvertTransitionTypes.prefab.meta | 7 + .../CrossLayerTypeConsistency.prefab | 430 +++++++ .../CrossLayerTypeConsistency.prefab.meta | 7 + .../TypeAdjustment/ac1.controller | 1060 +++++++++++++++++ .../TypeAdjustment/ac1.controller.meta | 8 + .../TypeAdjustment/ac2.controller | 67 ++ .../TypeAdjustment/ac2.controller.meta | 8 + .../TypeAdjustment/ac_empty.controller | 43 + .../TypeAdjustment/ac_empty.controller.meta | 8 + .../TypeAdjustment/cltc_0.controller | 104 ++ .../TypeAdjustment/cltc_0.controller.meta | 8 + .../TypeAdjustment/cltc_1.controller | 104 ++ .../TypeAdjustment/cltc_1.controller.meta | 8 + UnitTests~/TestBase.cs | 7 +- 24 files changed, 2783 insertions(+), 9 deletions(-) create mode 100644 UnitTests~/MergeAnimatorTests.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller.meta create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller create mode 100644 UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller.meta diff --git a/Editor/Animation/AnimatorCombiner.cs b/Editor/Animation/AnimatorCombiner.cs index 9bab7d6d..cd6f56a7 100644 --- a/Editor/Animation/AnimatorCombiner.cs +++ b/Editor/Animation/AnimatorCombiner.cs @@ -25,8 +25,6 @@ using System; using System.Collections.Generic; using System.Linq; -using nadena.dev.modular_avatar.animation; -using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.ndmf.util; using UnityEditor; @@ -43,6 +41,7 @@ namespace nadena.dev.modular_avatar.animation { internal class AnimatorCombiner { + private readonly ndmf.BuildContext _context; private readonly AnimatorController _combined; private readonly DeepClone _deepClone; @@ -79,11 +78,13 @@ namespace nadena.dev.modular_avatar.animation _combined.name = assetName; + _context = context; _deepClone = new DeepClone(context); } public AnimatorController Finish() { + FixTransitionTypeConflicts(); PruneEmptyLayers(); _combined.parameters = _parameters.Values.ToArray(); @@ -91,6 +92,197 @@ namespace nadena.dev.modular_avatar.animation return _combined; } + public void MergeTypes(Dictionary types) + { + foreach (var p in _parameters.ToList()) + { + if (types.TryGetValue(p.Key, out var outerValue)) + { + if (outerValue == p.Value.type) continue; + + if (outerValue == AnimatorControllerParameterType.Trigger + || p.Value.type == AnimatorControllerParameterType.Trigger) + { + BuildReport.LogFatal("error.merge_animator.param_type_mismatch", + p.Key, + p.Value.type, + outerValue + ); + } + + _parameters[p.Key].type = AnimatorControllerParameterType.Float; + types[p.Key] = AnimatorControllerParameterType.Float; + } + else + { + types.Add(p.Key, p.Value.type); + } + } + } + + /// + /// When we merge multiple controllers with different types for the same parameter, we merge + /// them all into using floats; thanks to VRChat's implicit typecasting, we can do this even for + /// parameters registered as being ints or bools in the expressions parameter asset. However, + /// we do need to fix any transitions to use the right transition types after this conversion. + /// + private void FixTransitionTypeConflicts() + { + foreach (var layer in _layers) + { + foreach (var asset in layer.stateMachine.ReferencedAssets(includeScene: false)) + { + if (asset is AnimatorState s) + { + s.transitions = s.transitions.SelectMany(FixupTransition).ToArray(); + } + } + + layer.stateMachine.entryTransitions = layer.stateMachine.entryTransitions + .SelectMany(FixupTransition).ToArray(); + layer.stateMachine.anyStateTransitions = layer.stateMachine.anyStateTransitions + .SelectMany(FixupTransition).ToArray(); + } + } + + private IEnumerable FixupTransition(T t) where T: AnimatorTransitionBase, new() + { + if (!NeedsFixing(t.conditions)) + { + yield return t; + yield break; + } + + AnimatorCondition[][][] combinations = t.conditions.Select(c => FixupCondition(c).ToArray()).ToArray(); + + // Generate the combinatorial explosion of conditions needed to emulate NotEquals with floats... + var conditions = ExplodeConditions(combinations).ToArray(); + + if (conditions.Length == 1) + { + t.conditions = conditions[0]; + yield return t; + } + else + { + foreach (var conditionGroup in conditions) + { + t.conditions = conditionGroup; + yield return t; + + var newTransition = new T(); + EditorUtility.CopySerialized(t, newTransition); + if (_context.AssetContainer != null) + { + AssetDatabase.AddObjectToAsset(newTransition, _context.AssetContainer); + } + t = newTransition; + } + } + } + + private bool NeedsFixing(AnimatorCondition[] conditions) + { + return conditions.Any(c => + { + if (!_parameters.TryGetValue(c.parameter, out var param)) return false; + + switch (c.mode) + { + case AnimatorConditionMode.If when param.type != AnimatorControllerParameterType.Bool: + case AnimatorConditionMode.IfNot when param.type != AnimatorControllerParameterType.Bool: + case AnimatorConditionMode.Equals when param.type != AnimatorControllerParameterType.Int: + case AnimatorConditionMode.NotEqual when param.type != AnimatorControllerParameterType.Int: + return true; + default: + return false; + } + }); + } + + private IEnumerable ExplodeConditions(AnimatorCondition[][][] conditions) + { + int[] indices = new int[conditions.Length]; + + while (true) + { + yield return conditions.SelectMany((group, i_) => group[indices[i_]]).ToArray(); + + // Increment the rightmost possible counter + int i; + for (i = indices.Length - 1; i >= 0; i--) + { + if (indices[i] < conditions[i].Length - 1) + { + indices[i]++; + // Unity 2019..... + // System.Array.Fill(indices, 0, i + 1, indices.Length - i - 1); + for (int j = i + 1; j < indices.Length; j++) + { + indices[j] = 0; + } + break; + } + } + + if (i < 0) break; + } + } + + private IEnumerable FixupCondition(AnimatorCondition c) + { + if (!_parameters.TryGetValue(c.parameter, out var paramDef)) + { + // Parameter is undefined, don't touch this condition + yield return new[] { c }; + yield break; + } + + switch (c.mode) + { + case AnimatorConditionMode.If when paramDef.type == AnimatorControllerParameterType.Float: + { + c.mode = AnimatorConditionMode.Greater; + c.threshold = 0.5f; + yield return new[] { c }; + break; + } + case AnimatorConditionMode.IfNot when paramDef.type == AnimatorControllerParameterType.Float: + { + c.mode = AnimatorConditionMode.Less; + c.threshold = 0.5f; + yield return new[] { c }; + break; + } + case AnimatorConditionMode.Equals when paramDef.type == AnimatorControllerParameterType.Float: + { + var c1 = c; + var c2 = c; + c1.mode = AnimatorConditionMode.Greater; + c1.threshold -= 0.1f; + c2.mode = AnimatorConditionMode.Less; + c2.threshold += 0.1f; + yield return new[] { c1, c2 }; + break; + } + case AnimatorConditionMode.NotEqual when paramDef.type == AnimatorControllerParameterType.Float: + { + var origThresh = c.threshold; + c.mode = AnimatorConditionMode.Greater; + c.threshold = origThresh + 0.1f; + yield return new[] { c }; + + c.mode = AnimatorConditionMode.Less; + c.threshold = origThresh - 0.1f; + yield return new[] { c }; + break; + } + default: + yield return new[] { c }; + break; + } + } + private void PruneEmptyLayers() { var originalLayers = _layers; @@ -184,7 +376,9 @@ namespace nadena.dev.modular_avatar.animation { if (_parameters.TryGetValue(param.name, out var acp)) { - if (acp.type != param.type) + if (acp.type != param.type && + (acp.type == AnimatorControllerParameterType.Trigger || + param.type == AnimatorControllerParameterType.Trigger)) { BuildReport.LogFatal("error.merge_animator.param_type_mismatch", param.name, @@ -195,9 +389,20 @@ namespace nadena.dev.modular_avatar.animation ); } + acp.type = AnimatorControllerParameterType.Float; + continue; } + var clonedParameter = new AnimatorControllerParameter() + { + name = param.name, + type = param.type, + defaultBool = param.defaultBool, + defaultFloat = param.defaultFloat, + defaultInt = param.defaultInt + }; + _parameters.Add(param.name, param); _parameterSource.Add(param.name, controller); } diff --git a/Editor/MergeAnimatorProcessor.cs b/Editor/MergeAnimatorProcessor.cs index 95371310..d6195868 100644 --- a/Editor/MergeAnimatorProcessor.cs +++ b/Editor/MergeAnimatorProcessor.cs @@ -161,6 +161,20 @@ namespace nadena.dev.modular_avatar.core.editor { layers = (VRCAvatarDescriptor.CustomAnimLayer[])layers.Clone(); + // Ensure types are consistent across layers + Dictionary types = + new Dictionary(); + // Learn types... + foreach (var session in mergeSessions.Values) + { + session.MergeTypes(types); + } + // And propagate them + foreach (var session in mergeSessions.Values) + { + session.MergeTypes(types); + } + for (int i = 0; i < layers.Length; i++) { if (mergeSessions.TryGetValue(layers[i].type, out var session)) diff --git a/UnitTests~/Animation/LayerPruningTest.cs b/UnitTests~/Animation/LayerPruningTest.cs index fffc2d27..c5af1638 100644 --- a/UnitTests~/Animation/LayerPruningTest.cs +++ b/UnitTests~/Animation/LayerPruningTest.cs @@ -19,7 +19,7 @@ namespace modular_avatar_tests var prefab = CreatePrefab("LayerPruningTest.prefab"); AvatarProcessor.ProcessAvatar(prefab); - var fxController = (AnimatorController) FindFxController(prefab).animatorController; + var fxController = (AnimatorController) FindController(prefab, VRCAvatarDescriptor.AnimLayerType.FX).animatorController; var l0 = fxController.layers[0]; var l1 = fxController.layers[1]; var l2 = fxController.layers[2]; diff --git a/UnitTests~/Animation/MergeBlendTreeTest.cs b/UnitTests~/Animation/MergeBlendTreeTest.cs index 378be6ad..d1b934cc 100644 --- a/UnitTests~/Animation/MergeBlendTreeTest.cs +++ b/UnitTests~/Animation/MergeBlendTreeTest.cs @@ -45,7 +45,7 @@ namespace modular_avatar_tests AvatarProcessor.ProcessAvatar(root); - var fxController = FindFxController(root).animatorController as AnimatorController; + var fxController = FindController(root, VRCAvatarDescriptor.AnimLayerType.FX).animatorController as AnimatorController; var fx = findFxLayer(root, MergeBlendTreePass.BlendTreeLayerName); Assert.AreSame(fxController.layers[0].stateMachine, fx.stateMachine); Assert.AreEqual(1, fx.stateMachine.states.Length); @@ -112,7 +112,7 @@ namespace modular_avatar_tests AvatarProcessor.ProcessAvatar(root); - var layerNames = (FindFxController(root).animatorController as AnimatorController) + var layerNames = (FindController(root, VRCAvatarDescriptor.AnimLayerType.FX).animatorController as AnimatorController) .layers.Select(l => l.name).ToArray(); Assert.AreEqual(new[] {MergeBlendTreePass.BlendTreeLayerName, "m2", "Eyes", "FaceMood", "m1", "m3"}, layerNames); diff --git a/UnitTests~/Animation/MergeOrderTest.cs b/UnitTests~/Animation/MergeOrderTest.cs index 54ec35e8..31831d44 100644 --- a/UnitTests~/Animation/MergeOrderTest.cs +++ b/UnitTests~/Animation/MergeOrderTest.cs @@ -4,6 +4,7 @@ using System.Linq; using nadena.dev.ndmf; using NUnit.Framework; using UnityEditor.Animations; +using VRC.SDK3.Avatars.Components; namespace modular_avatar_tests { @@ -16,9 +17,9 @@ namespace modular_avatar_tests AvatarProcessor.ProcessAvatar(root); - var fxController = FindFxController(root); + var fxController = FindController(root, VRCAvatarDescriptor.AnimLayerType.FX); - var layerNames = (FindFxController(root).animatorController as AnimatorController) + var layerNames = (FindController(root, VRCAvatarDescriptor.AnimLayerType.FX).animatorController as AnimatorController) .layers.Select(l => l.name).ToArray(); Assert.AreEqual(new [] diff --git a/UnitTests~/MergeAnimatorTests.meta b/UnitTests~/MergeAnimatorTests.meta new file mode 100644 index 00000000..ccbffa16 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c449d0dee44da544a80e1cfe78c849a0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment.meta new file mode 100644 index 00000000..3c76bf4f --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cbbe69f3bd9989841bc9107fce514c32 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs new file mode 100644 index 00000000..720482b0 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs @@ -0,0 +1,229 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using modular_avatar_tests; +using nadena.dev.ndmf; +using NUnit.Framework; +using UnityEditor.Animations; +using UnityEngine; +using VRC.SDK3.Avatars.Components; + +public class ConvertTransitionTypes : TestBase +{ + [Test] + public void IntConversions() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "int transitions"); + AssertTransitions(layer, "int", "gt1", 0, ("int", AnimatorConditionMode.Greater, 1)); + AssertTransitions(layer, "int", "lt1", 0, ("int", AnimatorConditionMode.Less, 1)); + AssertTransitions(layer, "int", "eq1", 0, + ("int", AnimatorConditionMode.Greater, 0.9f), + ("int", AnimatorConditionMode.Less, 1.1f) + ); + AssertTransitions(layer, "int", "ne1", 0, ("int", AnimatorConditionMode.Greater, 1.1f)); + AssertTransitions(layer, "int", "ne1", 1, ("int", AnimatorConditionMode.Less, 0.9f)); + AssertTransitions(layer, "int", "ne_multi", 0, + ("int", AnimatorConditionMode.Greater, 1.1f), + ("int2", AnimatorConditionMode.Greater, 2.1f) + ); + AssertTransitions(layer, "int", "ne_multi", 1, + ("int", AnimatorConditionMode.Greater, 1.1f), + ("int2", AnimatorConditionMode.Less, 1.9f) + ); + AssertTransitions(layer, "int", "ne_multi", 2, + ("int", AnimatorConditionMode.Less, 0.9f), + ("int2", AnimatorConditionMode.Greater, 2.1f) + ); + AssertTransitions(layer, "int", "ne_multi", 3, + ("int", AnimatorConditionMode.Less, 0.9f), + ("int2", AnimatorConditionMode.Less, 1.9f) + ); + } + + [Test] + public void BoolConversions() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "bool transitions"); + AssertTransitions(layer, "bool", "true", 0, ("bool", AnimatorConditionMode.Greater, 0.5f)); + AssertTransitions(layer, "bool", "false", 0, ("bool", AnimatorConditionMode.Less, 0.5f)); + } + + [Test] + public void FloatUnchanged() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "float transitions"); + AssertTransitions(layer, "float", "gt", 0, ("float", AnimatorConditionMode.Greater, 123)); + AssertTransitions(layer, "float", "lt", 0, ("float", AnimatorConditionMode.Less, 123)); + } + + [Test] + public void AnyState() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "anystate"); + var anyStateTransitions = layer.stateMachine.anyStateTransitions; + + AssertSingleTransition(anyStateTransitions[0], ("int", AnimatorConditionMode.Greater, 0.1f)); + AssertSingleTransition(anyStateTransitions[1], ("int", AnimatorConditionMode.Less, -0.1f)); + } + + + [Test] + public void Entry() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "entry"); + var transitions = layer.stateMachine.entryTransitions; + + AssertSingleTransition(transitions[0], ("int", AnimatorConditionMode.Greater, 0.1f)); + AssertSingleTransition(transitions[1], ("int", AnimatorConditionMode.Less, -0.1f)); + } + + [Test] + public void PreservesTransitionConfig() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var layer = findFxLayer(prefab, "preserve_config"); + + var state = FindStateInLayer(layer, "foo"); + Assert.AreEqual(123, layer.stateMachine.anyStateTransitions[0].duration); + Assert.AreEqual(123, state.transitions[0].exitTime); + } + + [Test] + public void ConversionWhenInconsistent() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var fx = (AnimatorController) FindFxController(prefab).animatorController; + + var p_types = fx.parameters.Select( + p => new KeyValuePair(p.name, p.type) + ).ToImmutableDictionary(); + + Assert.AreEqual(AnimatorControllerParameterType.Int, p_types["int3"]); + Assert.AreEqual(AnimatorControllerParameterType.Trigger, p_types["trigger"]); + Assert.AreEqual(AnimatorControllerParameterType.Float, p_types["bool"]); + Assert.AreEqual(AnimatorControllerParameterType.Float, p_types["int"]); + Assert.AreEqual(AnimatorControllerParameterType.Float, p_types["float"]); + Assert.AreEqual(AnimatorControllerParameterType.Float, p_types["int2"]); + } + + [Test] + public void NoConversionWhenConsistent() + { + var prefab = CreatePrefab("ConvertTransitionTypes.prefab"); + + UnityEngine.Object.DestroyImmediate(prefab.transform.Find("2").gameObject); + + AvatarProcessor.ProcessAvatar(prefab); + + var fx = (AnimatorController) FindFxController(prefab).animatorController; + + var p_types = fx.parameters.Select( + p => new KeyValuePair(p.name, p.type) + ).ToImmutableDictionary(); + + Assert.AreEqual(AnimatorControllerParameterType.Int, p_types["int3"]); + Assert.AreEqual(AnimatorControllerParameterType.Trigger, p_types["trigger"]); + Assert.AreEqual(AnimatorControllerParameterType.Bool, p_types["bool"]); + Assert.AreEqual(AnimatorControllerParameterType.Int, p_types["int"]); + Assert.AreEqual(AnimatorControllerParameterType.Float, p_types["float"]); + Assert.AreEqual(AnimatorControllerParameterType.Int, p_types["int2"]); + + var layer = findFxLayer(prefab, "int transitions"); + AssertTransitions(layer, "int", "eq1", 0, ("int", AnimatorConditionMode.Equals, 1f)); + } + + [Test] + public void CrossLayerTypeConsistency() + { + var prefab = CreatePrefab("CrossLayerTypeConsistency.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var fx = (AnimatorController) FindFxController(prefab).animatorController; + + var fx_types = fx.parameters.Select( + p => new KeyValuePair(p.name, p.type) + ).ToImmutableDictionary(); + + Assert.AreEqual(AnimatorControllerParameterType.Float, fx_types["bool"]); + + var fx_layer = fx.layers.First(l => l.name == "l"); + AssertSingleTransition(fx_layer.stateMachine.anyStateTransitions[0], ("bool", AnimatorConditionMode.Greater, 0.5f)); + + var action = (AnimatorController) FindController(prefab, VRCAvatarDescriptor.AnimLayerType.Action).animatorController; + + var action_types = action.parameters.Select( + p => new KeyValuePair(p.name, p.type) + ).ToImmutableDictionary(); + Assert.AreEqual(AnimatorControllerParameterType.Float, action_types["bool"]); + + var action_layer = action.layers.First(l => l.name == "l"); + AssertSingleTransition(action_layer.stateMachine.anyStateTransitions[0], ("bool", AnimatorConditionMode.Greater, 0)); + } + + void AssertTransitions(AnimatorControllerLayer layer, string src, string dest, int index, + params (string, AnimatorConditionMode, float)[] conditions) + { + var srcState = FindStateInLayer(layer, src); + + foreach (var s in layer.stateMachine.states) + { + Debug.Log("$$$ State: " + s.state.name); + foreach (var t0 in s.state.transitions) + { + Debug.Log("$$$ => " + t0.destinationState.name); + } + } + + var transitions = srcState.transitions.Where(t2 => t2.destinationState.name == dest) + .ToArray(); + var t = transitions[index]; + + AssertSingleTransition(t, conditions); + } + + private static void AssertSingleTransition(T t, + params (string, AnimatorConditionMode, float)[] conditions + ) where T: AnimatorTransitionBase + { + Assert.AreEqual(t.conditions.Length, conditions.Length); + + for (int i = 0; i < conditions.Length; i++) + { + var t_cond = t.conditions[i]; + var (e_param, e_mode, e_thresh) = conditions[i]; + + Assert.AreEqual(e_param, t_cond.parameter); + Assert.AreEqual(e_mode, t_cond.mode); + Assert.Less(Mathf.Abs(t_cond.threshold - e_thresh), 0.001f); + } + } +} + diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs.meta new file mode 100644 index 00000000..26349048 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e81482b11469b664386911716898aa9b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab new file mode 100644 index 00000000..c11d10fc --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab @@ -0,0 +1,431 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1264542558886155732 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2112710666216052914} + - component: {fileID: 3563451674332755173} + m_Layer: 0 + m_Name: 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2112710666216052914 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1264542558886155732} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6373179581926926786} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &3563451674332755173 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1264542558886155732} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bb122659f724ebf85fe095ac02dc339, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 9100000, guid: 39748a1cb2c33ca44926fc40c09f37c8, type: 2} + layerType: 5 + deleteAttachedAnimator: 0 + pathMode: 0 + matchAvatarWriteDefaults: 0 + relativePathRoot: + referencePath: + layerPriority: 0 +--- !u!1 &3957836390126773890 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3683911502407370956} + - component: {fileID: 1890891409117975684} + m_Layer: 0 + m_Name: 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3683911502407370956 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3957836390126773890} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6373179581926926786} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1890891409117975684 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3957836390126773890} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bb122659f724ebf85fe095ac02dc339, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 9100000, guid: 7df89b32015face4cb00de2bc1e82ce0, type: 2} + layerType: 5 + deleteAttachedAnimator: 0 + pathMode: 0 + matchAvatarWriteDefaults: 0 + relativePathRoot: + referencePath: + layerPriority: 0 +--- !u!1 &5272753184639627525 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6373179581926926786} + - component: {fileID: 265524611777631571} + - component: {fileID: 915165661785907967} + - component: {fileID: 7826662332881893537} + m_Layer: 0 + m_Name: ConvertTransitionTypes + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6373179581926926786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5272753184639627525} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.14671779, y: 0.4227038, z: 0.22339332} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3683911502407370956} + - {fileID: 2112710666216052914} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &265524611777631571 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5272753184639627525} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &915165661785907967 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5272753184639627525} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 542108242, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3} + m_Name: + m_EditorClassIdentifier: + Name: + ViewPosition: {x: 0, y: 1.6, z: 0.2} + Animations: 0 + ScaleIPD: 1 + lipSync: 0 + lipSyncJawBone: {fileID: 0} + lipSyncJawClosed: {x: 0, y: 0, z: 0, w: 1} + lipSyncJawOpen: {x: 0, y: 0, z: 0, w: 1} + VisemeSkinnedMesh: {fileID: 0} + MouthOpenBlendShapeName: Facial_Blends.Jaw_Down + VisemeBlendShapes: [] + unityVersion: + portraitCameraPositionOffset: {x: 0, y: 0, z: 0} + portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139} + networkIDs: [] + customExpressions: 1 + expressionsMenu: {fileID: 0} + expressionParameters: {fileID: 0} + enableEyeLook: 0 + customEyeLookSettings: + eyeMovement: + confidence: 0.5 + excitement: 0.5 + leftEye: {fileID: 0} + rightEye: {fileID: 0} + eyesLookingStraight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingUp: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingDown: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingLeft: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingRight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidType: 0 + upperLeftEyelid: {fileID: 0} + upperRightEyelid: {fileID: 0} + lowerLeftEyelid: {fileID: 0} + lowerRightEyelid: {fileID: 0} + eyelidsDefault: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsClosed: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingUp: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingDown: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsSkinnedMesh: {fileID: 0} + eyelidsBlendshapes: + customizeAnimationLayers: 1 + baseAnimationLayers: + - isEnabled: 0 + type: 0 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 4 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 5 + animatorController: {fileID: 9100000, guid: 3249e875a472a8341b1ad3151cef1051, + type: 2} + mask: {fileID: 0} + isDefault: 0 + specialAnimationLayers: + - isEnabled: 0 + type: 6 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 7 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 8 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + AnimationPreset: {fileID: 0} + animationHashSet: [] + autoFootsteps: 1 + autoLocomotion: 1 + collider_head: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_torso: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} +--- !u!114 &7826662332881893537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5272753184639627525} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1427037861, guid: 4ecd63eff847044b68db9453ce219299, type: 3} + m_Name: + m_EditorClassIdentifier: + launchedFromSDKPipeline: 0 + completedSDKPipeline: 0 + blueprintId: + contentType: 0 + assetBundleUnityVersion: + fallbackStatus: 0 diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab.meta new file mode 100644 index 00000000..6a8436ef --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ConvertTransitionTypes.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5a7bf82e11c60b34499df128db43995f +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab b/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab new file mode 100644 index 00000000..474e92e2 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab @@ -0,0 +1,430 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3639266076937693381 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4320058369893982630} + - component: {fileID: 6515486155343127979} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4320058369893982630 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3639266076937693381} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2366726236707392977} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6515486155343127979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3639266076937693381} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bb122659f724ebf85fe095ac02dc339, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 9100000, guid: ade8100c9a903fb4ca5046e539e67c2c, type: 2} + layerType: 5 + deleteAttachedAnimator: 0 + pathMode: 0 + matchAvatarWriteDefaults: 0 + relativePathRoot: + referencePath: + layerPriority: 0 +--- !u!1 &6959487909055347204 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6553629352900592484} + - component: {fileID: 5323417740160403864} + m_Layer: 0 + m_Name: GameObject (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6553629352900592484 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6959487909055347204} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2366726236707392977} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5323417740160403864 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6959487909055347204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bb122659f724ebf85fe095ac02dc339, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 9100000, guid: fa7df5e943c2ac24d9d9488b70831c8e, type: 2} + layerType: 4 + deleteAttachedAnimator: 0 + pathMode: 0 + matchAvatarWriteDefaults: 0 + relativePathRoot: + referencePath: + layerPriority: 0 +--- !u!1 &7774181568109795767 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2366726236707392977} + - component: {fileID: 8907566675985250583} + - component: {fileID: 7883572640581156853} + - component: {fileID: 4144361165177803043} + m_Layer: 0 + m_Name: CrossLayerTypeConsistency + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2366726236707392977 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7774181568109795767} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.14671779, y: 0.4227038, z: 0.22339332} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4320058369893982630} + - {fileID: 6553629352900592484} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &8907566675985250583 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7774181568109795767} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &7883572640581156853 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7774181568109795767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 542108242, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3} + m_Name: + m_EditorClassIdentifier: + Name: + ViewPosition: {x: 0, y: 1.6, z: 0.2} + Animations: 0 + ScaleIPD: 1 + lipSync: 0 + lipSyncJawBone: {fileID: 0} + lipSyncJawClosed: {x: 0, y: 0, z: 0, w: 1} + lipSyncJawOpen: {x: 0, y: 0, z: 0, w: 1} + VisemeSkinnedMesh: {fileID: 0} + MouthOpenBlendShapeName: Facial_Blends.Jaw_Down + VisemeBlendShapes: [] + unityVersion: + portraitCameraPositionOffset: {x: 0, y: 0, z: 0} + portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139} + networkIDs: [] + customExpressions: 0 + expressionsMenu: {fileID: 0} + expressionParameters: {fileID: 0} + enableEyeLook: 0 + customEyeLookSettings: + eyeMovement: + confidence: 0.5 + excitement: 0.5 + leftEye: {fileID: 0} + rightEye: {fileID: 0} + eyesLookingStraight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingUp: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingDown: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingLeft: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingRight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidType: 0 + upperLeftEyelid: {fileID: 0} + upperRightEyelid: {fileID: 0} + lowerLeftEyelid: {fileID: 0} + lowerRightEyelid: {fileID: 0} + eyelidsDefault: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsClosed: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingUp: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingDown: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsSkinnedMesh: {fileID: 0} + eyelidsBlendshapes: + customizeAnimationLayers: 0 + baseAnimationLayers: + - isEnabled: 0 + type: 0 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 4 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 5 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + specialAnimationLayers: + - isEnabled: 0 + type: 6 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 7 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 8 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + AnimationPreset: {fileID: 0} + animationHashSet: [] + autoFootsteps: 1 + autoLocomotion: 1 + collider_head: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_torso: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} +--- !u!114 &4144361165177803043 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7774181568109795767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1427037861, guid: 4ecd63eff847044b68db9453ce219299, type: 3} + m_Name: + m_EditorClassIdentifier: + launchedFromSDKPipeline: 0 + completedSDKPipeline: 0 + blueprintId: + contentType: 0 + assetBundleUnityVersion: + fallbackStatus: 0 diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab.meta new file mode 100644 index 00000000..0282a293 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/CrossLayerTypeConsistency.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9d63aa262c809e644b8b16248ef5ac9c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller new file mode 100644 index 00000000..6c449628 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller @@ -0,0 +1,1060 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-8277159016159921547 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: false + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-7974500618096210620 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: bool transitions + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3477782397476088704} + m_Position: {x: 240, y: 250, z: 0} + - serializedVersion: 1 + m_State: {fileID: -3110827086531072188} + m_Position: {x: 500, y: 180, z: 0} + - serializedVersion: 1 + m_State: {fileID: -8277159016159921547} + m_Position: {x: 500, y: 310, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3477782397476088704} +--- !u!1101 &-6702605715029525197 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: float + m_EventTreshold: 123 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -4009688686280353834} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-6520172362946588271 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-6194600427534614357 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: float transitions + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 8046166476842693713} + m_Position: {x: 290, y: 200, z: 0} + - serializedVersion: 1 + m_State: {fileID: -4009688686280353834} + m_Position: {x: 530, y: 140, z: 0} + - serializedVersion: 1 + m_State: {fileID: 308203126016203391} + m_Position: {x: 530, y: 270, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 8046166476842693713} +--- !u!1101 &-5608697223575902073 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: float + m_EventTreshold: 123 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 308203126016203391} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-4524131241659754034 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: foo + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -2627224102296642877} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &-4368305286771224427 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 7 + m_ConditionEvent: int + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -6520172362946588271} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-4009688686280353834 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: gt + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &-3477782397476088704 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: bool + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -1545596635161646672} + - {fileID: 7325309496740777746} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &-3110827086531072188 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: true + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-2770193565841106146 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: preserve_config + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 5318042209541246722} + m_Position: {x: 20, y: 260, z: 0} + - serializedVersion: 1 + m_State: {fileID: -4524131241659754034} + m_Position: {x: 360, y: 80, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 7060324165672602268} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 5318042209541246722} +--- !u!1101 &-2627224102296642877 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 5318042209541246722} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 123 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &-2544140858103475187 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: int + m_EventTreshold: 1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -1369888561700236705} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &-1545596635161646672 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -3110827086531072188} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-1369888561700236705 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: lt1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ac1 + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: bool + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: int + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: float + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: int2 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: int3 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: trigger + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: int transitions + m_StateMachine: {fileID: 3481636103936069629} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + - serializedVersion: 5 + m_Name: bool transitions + m_StateMachine: {fileID: -7974500618096210620} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 1 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + - serializedVersion: 5 + m_Name: float transitions + m_StateMachine: {fileID: -6194600427534614357} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 1 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + - serializedVersion: 5 + m_Name: anystate + m_StateMachine: {fileID: 2101233559568525048} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 1 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + - serializedVersion: 5 + m_Name: entry + m_StateMachine: {fileID: 1295763793390363486} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 1 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + - serializedVersion: 5 + m_Name: preserve_config + m_StateMachine: {fileID: -2770193565841106146} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 1 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &308203126016203391 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: lt + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &388538912781318264 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: eq1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1081843385552069750 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: gt1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1295763793390363486 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: entry + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 2331480681644977070} + m_Position: {x: 20, y: 290, z: 0} + - serializedVersion: 1 + m_State: {fileID: 8300524776750527964} + m_Position: {x: 360, y: 120, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: + - {fileID: 6482949225251473226} + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 2331480681644977070} +--- !u!1107 &2101233559568525048 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: anystate + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -6520172362946588271} + m_Position: {x: 360, y: 20, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: -4368305286771224427} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -6520172362946588271} +--- !u!1102 &2331480681644977070 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &2711400926320987342 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: int + m_EventTreshold: 1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1081843385552069750} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1107 &3481636103936069629 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: int transitions + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3486893397797024819} + m_Position: {x: 240, y: 240, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1081843385552069750} + m_Position: {x: 510, y: 160, z: 0} + - serializedVersion: 1 + m_State: {fileID: -1369888561700236705} + m_Position: {x: 510, y: 220, z: 0} + - serializedVersion: 1 + m_State: {fileID: 388538912781318264} + m_Position: {x: 510, y: 280, z: 0} + - serializedVersion: 1 + m_State: {fileID: 9016058555155253778} + m_Position: {x: 510, y: 340, z: 0} + - serializedVersion: 1 + m_State: {fileID: 7135989720185879126} + m_Position: {x: 510, y: 400, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3486893397797024819} +--- !u!1102 &3486893397797024819 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: int + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 2711400926320987342} + - {fileID: 8203883977472633529} + - {fileID: -2544140858103475187} + - {fileID: 5126371589843459001} + - {fileID: 7085359437149011441} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &5126371589843459001 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: int + m_EventTreshold: 1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 388538912781318264} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &5318042209541246722 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1109 &6482949225251473226 +AnimatorTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 7 + m_ConditionEvent: int + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 8300524776750527964} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 1 +--- !u!1101 &7060324165672602268 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -4524131241659754034} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 123 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &7085359437149011441 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 7 + m_ConditionEvent: int + m_EventTreshold: 1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 9016058555155253778} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &7135989720185879126 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ne_multi + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &7325309496740777746 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 2 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -8277159016159921547} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &8046166476842693713 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: float + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -6702605715029525197} + - {fileID: -5608697223575902073} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &8203883977472633529 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 7 + m_ConditionEvent: int + m_EventTreshold: 1 + - m_ConditionMode: 7 + m_ConditionEvent: int2 + m_EventTreshold: 2 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 7135989720185879126} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &8300524776750527964 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State 0 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &9016058555155253778 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ne1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller.meta new file mode 100644 index 00000000..24993d6d --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac1.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7df89b32015face4cb00de2bc1e82ce0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller new file mode 100644 index 00000000..f80d617b --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller @@ -0,0 +1,67 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ac2 + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: float + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: bool + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: int + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: int2 + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 3481636103936069629} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &3481636103936069629 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: [] + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 0} diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller.meta new file mode 100644 index 00000000..91df7835 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac2.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39748a1cb2c33ca44926fc40c09f37c8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller new file mode 100644 index 00000000..ac193692 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ac_empty + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 2471155352938139103} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &2471155352938139103 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: [] + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 0} diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller.meta new file mode 100644 index 00000000..0dfbedb7 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/ac_empty.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3249e875a472a8341b1ad3151cef1051 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller new file mode 100644 index 00000000..a72b9dcd --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller @@ -0,0 +1,104 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-385756315321488699 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: cltc_0 + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: bool + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: l + m_StateMachine: {fileID: 6926168581898200902} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &5840619603552301365 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -385756315321488699} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1107 &6926168581898200902 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: l + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -385756315321488699} + m_Position: {x: 330, y: 130, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 5840619603552301365} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -385756315321488699} diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller.meta new file mode 100644 index 00000000..ba12dd0a --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_0.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ade8100c9a903fb4ca5046e539e67c2c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller new file mode 100644 index 00000000..0ed1d9d4 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller @@ -0,0 +1,104 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1101 &-1049368330081820994 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: bool + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 3643915493798889361} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: cltc_1 + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: bool + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: l + m_StateMachine: {fileID: 6926168581898200902} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &3643915493798889361 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &6926168581898200902 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: l + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3643915493798889361} + m_Position: {x: 360, y: 50, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: -1049368330081820994} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3643915493798889361} diff --git a/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller.meta b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller.meta new file mode 100644 index 00000000..8b58d176 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/TypeAdjustment/cltc_1.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa7df5e943c2ac24d9d9488b70831c8e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/TestBase.cs b/UnitTests~/TestBase.cs index 6ca8a22f..da2506d2 100644 --- a/UnitTests~/TestBase.cs +++ b/UnitTests~/TestBase.cs @@ -155,9 +155,14 @@ namespace modular_avatar_tests } internal static VRCAvatarDescriptor.CustomAnimLayer FindFxController(GameObject prefab) + { + return FindController(prefab, VRCAvatarDescriptor.AnimLayerType.FX); + } + + internal static VRCAvatarDescriptor.CustomAnimLayer FindController(GameObject prefab, VRCAvatarDescriptor.AnimLayerType layerType) { return prefab.GetComponent().baseAnimationLayers - .FirstOrDefault(l => l.type == VRCAvatarDescriptor.AnimLayerType.FX); + .FirstOrDefault(l => l.type == layerType); } #endif }