From f99930999e77a2909da0003af7350738a1e55dc7 Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 21 Feb 2024 20:40:31 +0900 Subject: [PATCH] fix: compatibility break with animator defaults (#686) Changes in 1.9.0 broke existing avatars that used animators with different default values than the MA Parameters fields. This change makes overriding the animator defaults require an explicit configuration; this is technically a change which would require a minor version bump, but as this is addressing a major-version-level compatibility break in 1.9.0, we're going to push this out at a minor version this time. --- Editor/ApplyAnimatorDefaultValuesPass.cs | 11 +- .../Parameters/ParameterConfigDrawer.cs | 36 +- .../Parameters/ParameterConfigDrawer.uxml | 14 +- Editor/Inspector/Parameters/Parameters.uss | 16 +- Editor/RenameParametersHook.cs | 17 +- Runtime/ModularAvatarParameters.cs | 23 +- .../PreexistingAnimatorParams.meta | 8 + .../Preexisting.controller | 73 +++ .../Preexisting.controller.meta | 8 + .../PreexistingParamsTest.cs | 37 ++ .../PreexistingParamsTest.cs.meta | 11 + .../PreexistingParamsTest.prefab | 421 ++++++++++++++++++ .../PreexistingParamsTest.prefab.meta | 7 + docs~/docs/reference/parameters.md | 4 + .../current/reference/parameters.md | 4 + 15 files changed, 665 insertions(+), 25 deletions(-) create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams.meta create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller.meta create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs.meta create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab create mode 100644 UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab.meta diff --git a/Editor/ApplyAnimatorDefaultValuesPass.cs b/Editor/ApplyAnimatorDefaultValuesPass.cs index f416a3bd..587042e8 100644 --- a/Editor/ApplyAnimatorDefaultValuesPass.cs +++ b/Editor/ApplyAnimatorDefaultValuesPass.cs @@ -1,16 +1,21 @@ -using System; +#region + +using System; using System.Collections.Immutable; using System.Linq; using nadena.dev.ndmf; +using UnityEditor.Animations; using UnityEngine; +#endregion + namespace nadena.dev.modular_avatar.core.editor { internal class ApplyAnimatorDefaultValuesPass : Pass { protected override void Execute(ndmf.BuildContext context) { - var values = context.GetState()?.InitialValue + var values = context.GetState()?.InitialValueOverrides ?? ImmutableDictionary.Empty; foreach (var layer in context.AvatarDescriptor.baseAnimationLayers @@ -19,7 +24,7 @@ namespace nadena.dev.modular_avatar.core.editor if (layer.isDefault || layer.animatorController == null) continue; // We should have converted anything that's not an AnimationController by now - var controller = layer.animatorController as UnityEditor.Animations.AnimatorController; + var controller = layer.animatorController as AnimatorController; if (controller == null || !context.IsTemporaryAsset(controller)) { throw new Exception("Leaked unexpected controller: " + layer.animatorController + " (type " + layer.animatorController?.GetType() + ")"); diff --git a/Editor/Inspector/Parameters/ParameterConfigDrawer.cs b/Editor/Inspector/Parameters/ParameterConfigDrawer.cs index 76dc9026..7bc498d9 100644 --- a/Editor/Inspector/Parameters/ParameterConfigDrawer.cs +++ b/Editor/Inspector/Parameters/ParameterConfigDrawer.cs @@ -47,22 +47,48 @@ namespace nadena.dev.modular_avatar.core.editor.Parameters var value = evt.changedProperty.boolValue; if (value) { - root.AddToClassList("ParameterConfig__isPrefix"); + root.AddToClassList("ParameterConfig__isPrefix_true"); + root.RemoveFromClassList("ParameterConfig__isPrefix_false"); } else { - root.RemoveFromClassList("ParameterConfig__isPrefix"); + root.AddToClassList("ParameterConfig__isPrefix_false"); + root.RemoveFromClassList("ParameterConfig__isPrefix_true"); } isPrefix = value; evaluateMiniDisplay(); }); - + + var syncTypeProp = root.Q("syncType"); + // TODO: This callback is not actually invoked on initial bind... + syncTypeProp.RegisterValueChangeCallback(evt => + { + var value = (ParameterSyncType) evt.changedProperty.enumValueIndex; + if (value == ParameterSyncType.NotSynced) + { + root.AddToClassList("ParameterConfig__animatorOnly_true"); + root.RemoveFromClassList("ParameterConfig__animatorOnly_false"); + } + else + { + root.AddToClassList("ParameterConfig__animatorOnly_false"); + + root.RemoveFromClassList("ParameterConfig__animatorOnly_true"); + } + }); + + /* + var overridePlaceholder = root.Q("overridePlaceholder"); + overridePlaceholder.labelElement.AddToClassList("ndmf-tr"); + overridePlaceholder.SetEnabled(false); + */ + var remapTo = root.Q("remapTo"); var remapToPlaceholder = root.Q("remapToPlaceholder"); - remapToPlaceholder.SetEnabled(false); - remapToPlaceholder.labelElement.AddToClassList("ndmf-tr"); + remapToPlaceholder.SetEnabled(false); + Localization.UI.Localize(remapToPlaceholder.labelElement); root.Q("internalParameter").RegisterValueChangeCallback(evt => diff --git a/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml b/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml index 993eaf16..1ac0d20a 100644 --- a/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml +++ b/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml @@ -15,7 +15,9 @@ - + - - + + + + + diff --git a/Editor/Inspector/Parameters/Parameters.uss b/Editor/Inspector/Parameters/Parameters.uss index ed822df2..6e1b1f79 100644 --- a/Editor/Inspector/Parameters/Parameters.uss +++ b/Editor/Inspector/Parameters/Parameters.uss @@ -1,19 +1,19 @@ VisualElement {} -.ParameterConfig__isPrefix_falseOnly { - display: flex; -} - -.ParameterConfig__isPrefix_trueOnly { +.ParameterConfig__isPrefix_true .ParameterConfig__isPrefix_falseOnly { display: none; } -.ParameterConfig__isPrefix .ParameterConfig__isPrefix_falseOnly { +.ParameterConfig__isPrefix_false .ParameterConfig__isPrefix_trueOnly { display: none; } -.ParameterConfig__isPrefix .ParameterConfig__isPrefix_trueOnly { - display: flex; +.ParameterConfig__animatorOnly_true .ParameterConfig__animatorOnly_falseOnly { + display: none; +} + +.ParameterConfig__animatorOnly_false .ParameterConfig__animatorOnly_trueOnly { + display: none; } #defaultValueGroup { diff --git a/Editor/RenameParametersHook.cs b/Editor/RenameParametersHook.cs index 592bff98..7242f6f2 100644 --- a/Editor/RenameParametersHook.cs +++ b/Editor/RenameParametersHook.cs @@ -22,7 +22,7 @@ namespace nadena.dev.modular_avatar.core.editor { internal class DefaultValues { - public ImmutableDictionary InitialValue; + public ImmutableDictionary InitialValueOverrides; } internal class RenameParametersHook @@ -63,6 +63,10 @@ namespace nadena.dev.modular_avatar.core.editor public void MergeSibling(ParameterInfo info) { MergeCommon(info); + + ResolvedParameter.m_overrideAnimatorDefaults = + (ResolvedParameter.m_overrideAnimatorDefaults && ResolvedParameter.HasDefaultValue) || + (info.ResolvedParameter.m_overrideAnimatorDefaults && info.ResolvedParameter.HasDefaultValue); if (ResolvedParameter.HasDefaultValue && info.ResolvedParameter.HasDefaultValue) { @@ -73,6 +77,8 @@ namespace nadena.dev.modular_avatar.core.editor ConflictingValues = ConflictingValues.Add(info.ResolvedParameter.defaultValue); } } + + } public void MergeChild(ParameterInfo info) @@ -83,6 +89,7 @@ namespace nadena.dev.modular_avatar.core.editor { ResolvedParameter.defaultValue = info.ResolvedParameter.defaultValue; ResolvedParameter.hasExplicitDefaultValue = info.ResolvedParameter.hasExplicitDefaultValue; + ResolvedParameter.m_overrideAnimatorDefaults = info.ResolvedParameter.m_overrideAnimatorDefaults; } ResolvedParameter.saved = info.ResolvedParameter.saved; @@ -123,9 +130,11 @@ namespace nadena.dev.modular_avatar.core.editor var syncParams = WalkTree(avatar, ImmutableDictionary.Empty, ImmutableDictionary.Empty); SetExpressionParameters(avatar, syncParams); - - _context.PluginBuildContext.GetState().InitialValue - = syncParams.Where(p => p.Value.ResolvedParameter.HasDefaultValue) + + _context.PluginBuildContext.GetState().InitialValueOverrides + = syncParams.Where(p => + p.Value.ResolvedParameter.HasDefaultValue && + p.Value.ResolvedParameter.OverrideAnimatorDefaults) .ToImmutableDictionary(p => p.Key, p => p.Value.ResolvedParameter.defaultValue); } diff --git a/Runtime/ModularAvatarParameters.cs b/Runtime/ModularAvatarParameters.cs index 88b597df..2a857dec 100644 --- a/Runtime/ModularAvatarParameters.cs +++ b/Runtime/ModularAvatarParameters.cs @@ -1,7 +1,10 @@ -using System; +#region + +using System; using System.Collections.Generic; using UnityEngine; -using UnityEngine.Serialization; + +#endregion namespace nadena.dev.modular_avatar.core { @@ -21,6 +24,22 @@ namespace nadena.dev.modular_avatar.core public bool hasExplicitDefaultValue; + /// + /// Indicates that the default value for this parameter should be applied to any animators attached to the + /// avatar as well, rather than just the expressions menu configuration. + /// + /// Note: Private API for now; will be exposed in 1.10. This is always considered to be true if the parameter + /// is unsynced and has a default value override. + /// + [SerializeField] + internal bool m_overrideAnimatorDefaults; + + internal bool OverrideAnimatorDefaults + { + get => m_overrideAnimatorDefaults || syncType == ParameterSyncType.NotSynced && hasExplicitDefaultValue; + set => m_overrideAnimatorDefaults = value; + } + public bool HasDefaultValue => hasExplicitDefaultValue || Mathf.Abs(defaultValue) > VALUE_EPSILON; } diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams.meta b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams.meta new file mode 100644 index 00000000..9d66d274 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ded71f3352a2f143a917c23bf14760a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller new file mode 100644 index 00000000..6dadda05 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller @@ -0,0 +1,73 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-752819376345795800 +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} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Preexisting + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: no_default + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 11 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: animator_only + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 11 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: synced + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 11 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: no_default_override + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 11 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: default_override + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 11 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -752819376345795800} + 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} diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller.meta b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller.meta new file mode 100644 index 00000000..edadff3c --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/Preexisting.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f4d1ed09c262f70409af9399619152b8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs new file mode 100644 index 00000000..8af5146e --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using modular_avatar_tests; +using nadena.dev.modular_avatar.core; +using nadena.dev.ndmf; +using NUnit.Framework; +using UnityEditor.Animations; +using UnityEngine; +using VRC.SDK3.Avatars.Components; +using AvatarProcessor = nadena.dev.modular_avatar.core.editor.AvatarProcessor; + +public class PreexistingParamsTest : TestBase +{ + [Test] + public void TestPreexistingParameterOverwritePolicy() + { + var prefab = CreatePrefab("PreexistingParamsTest.prefab"); + AvatarProcessor.ProcessAvatar(prefab); + + var parameters = ((AnimatorController)FindFxController(prefab).animatorController).parameters; + var paramDict = parameters.ToImmutableDictionary(p => p.name, p => p.defaultInt); + + foreach (var kvp in paramDict) + { + if (kvp.Key == "default_override" || kvp.Key == "animator_only") + { + Assert.AreEqual(1, kvp.Value); + } + else + { + Assert.AreEqual(11, kvp.Value); + } + } + } +} + diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs.meta b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs.meta new file mode 100644 index 00000000..6919e1e2 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d303e057417431b42ac988ef079faf7a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab new file mode 100644 index 00000000..1e6e4f8b --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab @@ -0,0 +1,421 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &293715385600242937 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1103155402592938027} + - component: {fileID: 8138812128970776409} + m_Layer: 0 + m_Name: Param + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1103155402592938027 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 293715385600242937} + 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: 1845997253236798396} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8138812128970776409 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 293715385600242937} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: no_default + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 0 + localOnly: 0 + defaultValue: 0 + saved: 0 + hasExplicitDefaultValue: 0 + m_overrideAnimatorDefaults: 0 + - nameOrPrefix: animator_only + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 0 + localOnly: 0 + defaultValue: 1 + saved: 0 + hasExplicitDefaultValue: 1 + m_overrideAnimatorDefaults: 0 + - nameOrPrefix: synced + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 2 + saved: 0 + hasExplicitDefaultValue: 1 + m_overrideAnimatorDefaults: 0 + - nameOrPrefix: no_default_override + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0 + saved: 0 + hasExplicitDefaultValue: 0 + m_overrideAnimatorDefaults: 1 + - nameOrPrefix: default_override + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 1 + saved: 0 + hasExplicitDefaultValue: 1 + m_overrideAnimatorDefaults: 1 +--- !u!1 &8556977804701238147 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1845997253236798396} + - component: {fileID: 5970688004521109080} + - component: {fileID: 5601024012159522033} + - component: {fileID: 7851048422736913745} + m_Layer: 0 + m_Name: PreexistingParamsTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1845997253236798396 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8556977804701238147} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.5386686, y: 1.0673547, z: -5.4029636} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1103155402592938027} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &5970688004521109080 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8556977804701238147} + 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 &5601024012159522033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8556977804701238147} + 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: 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: f4d1ed09c262f70409af9399619152b8, + 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 &7851048422736913745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8556977804701238147} + 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/PreexistingAnimatorParams/PreexistingParamsTest.prefab.meta b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab.meta new file mode 100644 index 00000000..e183c5b7 --- /dev/null +++ b/UnitTests~/MergeAnimatorTests/PreexistingAnimatorParams/PreexistingParamsTest.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f8f5814f046dffa43aa536d3e24aa21e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/docs~/docs/reference/parameters.md b/docs~/docs/reference/parameters.md index c039c184..4bf00acc 100644 --- a/docs~/docs/reference/parameters.md +++ b/docs~/docs/reference/parameters.md @@ -30,6 +30,10 @@ saved. However, there is an exception; see the section on "Nesting" for more inf setting will be enabled if either MA Parameters or the original Expression Parameters asset enables saving for the parameter. +Normally, the default values you set will only affect the Expressions Parameters settings for your avatar. However, +you can override the default values for the _animator_ itself by either setting the "Parameter Type" to "Animator Only", +or by enabling the "Override Animator Defaults" checkbox (note that this is ignored for animator only parameters). + ### Renaming parameters By setting the "Change name to" field you can _rename_ a parameter. That is, if you have a parameter "foo", which has diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.md b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.md index 6df024dc..9ac72165 100644 --- a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.md +++ b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.md @@ -24,6 +24,10 @@ ParametersのUIは最初はたたんだ状態でパラメーター情報を表 「入れ子にする」に参照。なお、Expressions ParametersとMA Parameters両方に定義される場合は、どちらか(あるいは両方)に「保存する」が 有効になっていると、保存される扱いとなります。 +普段は設定した初期値はアバターのExpressions Parameters設定のみに適用されます。ただし、「パラメーター型」を「Animatorのみ」に設定するか、 +「アニメーターの初期値を設定」を有効にすることで、アニメーター自体の初期値を上書きすることができます。なお、「アニメーターの初期値を設定」は +「アニメーターのみ」の場合無視されます。 + ### 名前を変更 「名前を変更」欄に新しい名前を入れると、パラメーターのリネームができます。たとえば、「hoge」という名のパラメーターに、「piyo」という