diff --git a/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml b/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml index c0217356..993eaf16 100644 --- a/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml +++ b/Editor/Inspector/Parameters/ParameterConfigDrawer.uxml @@ -27,14 +27,12 @@ - - - - - - - - + " + + + + + diff --git a/Editor/RenameParametersHook.cs b/Editor/RenameParametersHook.cs index 7a212d9b..592bff98 100644 --- a/Editor/RenameParametersHook.cs +++ b/Editor/RenameParametersHook.cs @@ -84,6 +84,8 @@ namespace nadena.dev.modular_avatar.core.editor ResolvedParameter.defaultValue = info.ResolvedParameter.defaultValue; ResolvedParameter.hasExplicitDefaultValue = info.ResolvedParameter.hasExplicitDefaultValue; } + + ResolvedParameter.saved = info.ResolvedParameter.saved; } void MergeCommon(ParameterInfo info) @@ -108,6 +110,8 @@ namespace nadena.dev.modular_avatar.core.editor ConflictingValues = ConflictingValues.Union(info.ConflictingValues); ConflictingSyncTypes = ConflictingSyncTypes.Union(info.ConflictingSyncTypes); + ResolvedParameter.saved = ResolvedParameter.saved || info.ResolvedParameter.saved; + encounterOrder = Math.Min(encounterOrder, info.encounterOrder); } } @@ -208,6 +212,7 @@ namespace nadena.dev.modular_avatar.core.editor } expParams.parameters = parameters.ToArray(); + if (expParams.CalcTotalCost() > VRCExpressionParameters.MAX_PARAMETER_COST) { BuildReport.LogFatal("error.rename_params.too_many_synced_params", new[] @@ -253,8 +258,8 @@ namespace nadena.dev.modular_avatar.core.editor newParameter.name = parameter.name; newParameter.valueType = parameter.valueType; newParameter.networkSynced = parameter.networkSynced; - newParameter.saved = parameter.saved; - + newParameter.saved = parameter.saved || info.ResolvedParameter.saved; + return newParameter; } diff --git a/UnitTests~/RenameParametersTests/ParameterConflictTestParams.asset b/UnitTests~/RenameParametersTests/ParameterConflictTestParams.asset index f73dd4b9..6ccf96ac 100644 --- a/UnitTests~/RenameParametersTests/ParameterConflictTestParams.asset +++ b/UnitTests~/RenameParametersTests/ParameterConflictTestParams.asset @@ -14,6 +14,26 @@ MonoBehaviour: m_EditorClassIdentifier: parameters: - name: a + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 1 + - name: b + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 0 + - name: c + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 1 + - name: d + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 1 + - name: e valueType: 1 saved: 0 defaultValue: 0.5 diff --git a/UnitTests~/RenameParametersTests/ParameterConflicts.prefab b/UnitTests~/RenameParametersTests/ParameterConflicts.prefab index f485cb10..a07fe285 100644 --- a/UnitTests~/RenameParametersTests/ParameterConflicts.prefab +++ b/UnitTests~/RenameParametersTests/ParameterConflicts.prefab @@ -44,7 +44,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -99,7 +98,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -154,7 +152,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -209,7 +206,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -266,7 +262,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -648,7 +643,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -703,7 +697,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -758,7 +751,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -813,7 +805,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -868,7 +859,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -923,7 +913,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -978,7 +967,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -1036,7 +1024,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -1094,7 +1081,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -1150,7 +1136,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: @@ -1208,7 +1193,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} m_Name: m_EditorClassIdentifier: - migrationCompleted: 0 parameters: - nameOrPrefix: a remapTo: diff --git a/UnitTests~/RenameParametersTests/RenameParametersTests.cs b/UnitTests~/RenameParametersTests/RenameParametersTests.cs index ce016f64..0441d79c 100644 --- a/UnitTests~/RenameParametersTests/RenameParametersTests.cs +++ b/UnitTests~/RenameParametersTests/RenameParametersTests.cs @@ -129,7 +129,7 @@ namespace modular_avatar_tests.RenameParametersTests public void AnimatorOnlyParametersTests() { var prefab = CreatePrefab("AnimatorOnlyParameterValues/AOPV.prefab"); - + AvatarProcessor.ProcessAvatar(prefab); var fx = prefab.GetComponent().baseAnimationLayers @@ -138,25 +138,43 @@ namespace modular_avatar_tests.RenameParametersTests Assert.NotNull(fx); AssertParamStates(fx); - + var action = prefab.GetComponent().baseAnimationLayers .First(l => l.type == VRCAvatarDescriptor.AnimLayerType.FX) .animatorController as AnimatorController; Assert.NotNull(action); - + AssertParamStates(action); - + void AssertParamStates(AnimatorController controller) { var parameters = controller.parameters.Select( - p => new KeyValuePair(p.name, p) - ).ToImmutableDictionary(); - + p => new KeyValuePair(p.name, p) + ).ToImmutableDictionary(); + Assert.LessOrEqual(Mathf.Abs(parameters["float"].defaultFloat - 0.5f), 0.005f); Assert.AreEqual(23, parameters["int"].defaultInt); Assert.AreEqual(true, parameters["bool"].defaultBool); } } + + public void SavedParameterResolution() + { + var prefab = CreatePrefab("SavedParamResolution.prefab"); + + AvatarProcessor.ProcessAvatar(prefab); + + var expParams = prefab.GetComponent().expressionParameters.parameters + .Select(p => new KeyValuePair(p.name, p)) + .ToImmutableDictionary(); + + Assert.IsTrue(expParams["a"].saved); + Assert.IsTrue(expParams["b"].saved); + Assert.IsFalse(expParams["c"].saved); + Assert.IsTrue(expParams["d"].saved); + Assert.IsFalse(expParams["e"].saved); + Assert.IsTrue(expParams["f"].saved); + } } } diff --git a/UnitTests~/RenameParametersTests/SavedParamResolution.prefab b/UnitTests~/RenameParametersTests/SavedParamResolution.prefab new file mode 100644 index 00000000..b4084b39 --- /dev/null +++ b/UnitTests~/RenameParametersTests/SavedParamResolution.prefab @@ -0,0 +1,581 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1530946484152775677 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9018531205874519413} + - component: {fileID: 1450892749070254822} + m_Layer: 0 + m_Name: P + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &9018531205874519413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1530946484152775677} + 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: + - {fileID: 1004026017946301937} + m_Father: {fileID: 4330319568773249460} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1450892749070254822 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1530946484152775677} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: a + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0.1 + saved: 1 + hasExplicitDefaultValue: 1 + - nameOrPrefix: b + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0.1 + saved: 0 + hasExplicitDefaultValue: 1 + - nameOrPrefix: c + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0.1 + saved: 0 + hasExplicitDefaultValue: 1 +--- !u!1 &1723107023395060245 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4330319568773249460} + - component: {fileID: 3940830586206015896} + m_Layer: 0 + m_Name: ParentWins + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4330319568773249460 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1723107023395060245} + 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: + - {fileID: 9018531205874519413} + - {fileID: 2975848956331614837} + m_Father: {fileID: 4626702805245235648} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &3940830586206015896 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1723107023395060245} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: a + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0 + saved: 0 + hasExplicitDefaultValue: 0 +--- !u!1 &2017725079828776469 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1004026017946301937} + - component: {fileID: 2296002262718039012} + m_Layer: 0 + m_Name: P (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1004026017946301937 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2017725079828776469} + 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: 9018531205874519413} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2296002262718039012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2017725079828776469} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: a + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 1 + saved: 0 + hasExplicitDefaultValue: 1 +--- !u!1 &6770422488765167315 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2975848956331614837} + - component: {fileID: 2064238697324958721} + m_Layer: 0 + m_Name: P (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2975848956331614837 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6770422488765167315} + 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: 4330319568773249460} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2064238697324958721 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6770422488765167315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: a + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0 + saved: 0 + hasExplicitDefaultValue: 0 + - nameOrPrefix: b + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0 + saved: 1 + hasExplicitDefaultValue: 0 + - nameOrPrefix: c + remapTo: + internalParameter: 0 + isPrefix: 0 + syncType: 2 + localOnly: 0 + defaultValue: 0 + saved: 0 + hasExplicitDefaultValue: 0 +--- !u!1 &7084253093336051501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4626702805245235648} + - component: {fileID: 4852552130019921331} + - component: {fileID: 2446920962079874121} + - component: {fileID: 7800490051996613361} + m_Layer: 0 + m_Name: SavedParamResolution + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4626702805245235648 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7084253093336051501} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.19918329, y: 0.8600853, z: -0.6144587} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4330319568773249460} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4852552130019921331 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7084253093336051501} + 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: 11400000, guid: a595189001d956b429e278804db4f4b0, type: 2} + expressionParameters: {fileID: 11400000, guid: 9de5c7db05ac4b54f9954df994380e66, + type: 2} + 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 &2446920962079874121 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7084253093336051501} + 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 +--- !u!95 &7800490051996613361 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7084253093336051501} + 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 diff --git a/UnitTests~/RenameParametersTests/SavedParamResolution.prefab.meta b/UnitTests~/RenameParametersTests/SavedParamResolution.prefab.meta new file mode 100644 index 00000000..0c6d5527 --- /dev/null +++ b/UnitTests~/RenameParametersTests/SavedParamResolution.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7fb50d2a5bf2fb84ea1b11300f6e3b5d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset b/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset new file mode 100644 index 00000000..283de89c --- /dev/null +++ b/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset @@ -0,0 +1,45 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1506855854, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3} + m_Name: SavedParamResolutionParams + m_EditorClassIdentifier: + parameters: + - name: a + valueType: 1 + saved: 1 + defaultValue: 0.5 + networkSynced: 0 + - name: b + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 0 + - name: c + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 0 + - name: d + valueType: 1 + saved: 1 + defaultValue: 0.5 + networkSynced: 0 + - name: e + valueType: 1 + saved: 0 + defaultValue: 0.5 + networkSynced: 0 + - name: f + valueType: 1 + saved: 1 + defaultValue: 0.5 + networkSynced: 0 diff --git a/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset.meta b/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset.meta new file mode 100644 index 00000000..0a42875f --- /dev/null +++ b/UnitTests~/RenameParametersTests/SavedParamResolutionParams.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9de5c7db05ac4b54f9954df994380e66 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/docs~/docs/reference/parameters.md b/docs~/docs/reference/parameters.md index 07df8cea..c039c184 100644 --- a/docs~/docs/reference/parameters.md +++ b/docs~/docs/reference/parameters.md @@ -1,43 +1,83 @@ # Parameters -The Modular Avatar Parameters component allows you to define the animator parameters your prefab uses either internally, or to communicate with other components. -It allows the end-user to easily rename parameters to avoid conflicts, or to wire up multiple prefabs without having to alter animators directly. -It also allows for automatic configuration of synced parameters. +The Modular Avatar Parameters component allows you to define the animator parameters your gimmick uses either internally, +or to communicate with other components. It renames parameters to avoid conflicts, and defines synced and unsynced +animator parameters and their defaults -The Parameters component has two display modes: One for end-users of prefabs, and one for prefab developers. -End-users can rename fields, and configure their AV3 parameters settings (saved state and default value). -Developers can adjust the sync type and set parameters to be internal/hidden from end-users. +![Parameters UI](parameters.png) -![End-user display](parameters-enduser.png) ![Developer display](parameters-devmode.png) ## When should I use it? -The Parameters component should be used when you're building a prefab which makes use of animator parameters other than VRChat builtins. +The Parameters component should be used when you're building a gimmick which makes use of animator parameters other +than VRChat builtins. ## How do I use it? -### End-users +### Setting defaults -The parameters component on prefabs can be used to rename parameters to avoid conflicts, and to adjust whether synced parameters are saved across avatar reloads (and their default value). -By renaming multiple prefab parameters to be the same, you can make them all share the same state and animate at the same time. -Alternately, by changing conflicting names to be different, you can resolve prefab conflicts. -Finally, you can mark parameters as being unsynced to save on bandwidth, if desired. +The parameters UI shows each parameter initially in a collapsed view. This view makes it easy to set the default values +for each parameter, and whether they are saved when you change avatars, or change worlds. Setting a non-blank default +value will override the value in the main Expressions Parameters asset, if any. -### Prefab developers +You can set a blank value here as well; this can be useful if multiple MA Parameters components define the same +parameter, where the "default value" field will ignore any MA Parameters component which does not set a default. +Setting default values for the same parameter in multiple Parameters components will result in a warning, as it's +unclear which should be used. -Add the parameters component to the root of your prefab, and click "Show Prefab Developer Options". You'll see a list of all parameters used in your prefab. +For the "Saved" option, generally speaking the parameter will be saved if any MA Parameters component sets it to be +saved. However, there is an exception; see the section on "Nesting" for more information. Note also that the "Saved" +setting will be enabled if either MA Parameters or the original Expression Parameters asset enables saving for the +parameter. -Each parameter can be configured with the following options: +### Renaming parameters -* Internal - Hides the parameter, and automatically renames the parameter with a unique name. -* PhysBones Prefix - Indicates this is a parameter passed to a PhysBone "parameter" field (and thus it really references a number of sub-parameters) -* Param type - Indicates what type a parameter is, or if it's only present on the animator (and not the Expressions Parameters asset) +By setting the "Change name to" field you can _rename_ a parameter. That is, if you have a parameter "foo", which has +a "Change name to" setting of "bar", then on the object with the MA Parameters component and its children you can +refer to this parameter as "foo" (eg in [MA Menu Item](menu-item.md), [MA Merge Animator](merge-animator.md), or in +VRChat Contact Receivers); however, outside of this object, the parameter will be referred to as "bar". -Parameters components can be nested. This lets you build up a complex prefab out of sub-prefabs, some which may be added multiple times, and while avoiding parameter name conflicts. +By renaming parameters on multiple components to use the same name, you can wire up one gimmick to trigger another. +You can also select "Auto Rename" to have Modular Avatar automatically select an unused name; this will help avoid +accidental name collisions between different gimmicks. -Parameter renaming will be applied to the following components underneath (or on the same GameObject as) the Parameters component: -* [Modular Avatar Merge Animator](merge-animator.md) -* [Modular Avatar Menu Installer](menu-installer.md) -* VRC Physics Bone -* VRC Contact Receiver -* Animator (although this is unlikely to be very useful) +### Creating new parameters + +You can define a new parameter in two different ways. First, you can click the "+" button at the bottom of the list of +parameters; then click the chevron next to the parameter to set its name. + +Second, you can expand the "Unregistered Parameters" section; this section lists parameters which have been +detected in components inside this GameObject and its children. You can click the "Add" button to add the parameter, +or the magnifying glass to see where the parameter was detected. + +Either way, after creating the parameter, click the chevron next to the new parameter to expand the detailed view. +There, you can set the parameter type (which controls whether the parameter is synced), and other attributes of the +parameter. + +### PhysBones and Contacts + +MA Parameters can rename parameters used by VRChat PhysBone components and Contact Receivers. For PhysBones, enter the +prefix (the value in the "Parameter" field of the VRC Phys Bone component) as the parameter name, and click the +"Is PhysBone Prefix" option. This will be automatically set if you add it via the "Unregistered Parameters" section. + +### Expression Parameters + +Set the "Parameter type" field to register the parameter in the VRC Expressions Parameters list. This will sync the +parameter over the network, and allow for it to be used in the expressions menu and in OSC. If you don't need the +parameter to be synced, click "Local Only". + +### Nesting + +MA Parameters components can be nested. This lets you build up a complex system out of multiple subcomponents. Each +MA Parameters component can apply renamings to all of its children. This means that if you have an inner MA Parameters +which renames "foo" to "bar", and an outer MA Parameters which sets "bar" to "auto rename", you can still access "bar" +in the objects in-between. + +There are a few notable subtleties when nesting components: + +* The "Saved" parameter will take the outermost "Saved" setting. However, when multiple MA Parameters components which + are not nested set "Saved" to different values, the parameter will be saved if any of the components set it to be + saved. +* The "Default Value" field will take the outermost setting; however, if outer components have a blank default value, + the innermost non-blank default value will be used. If multiple components which are not nested set a non-blank + default value, a warning will be shown, as it's unclear which should be used. \ No newline at end of file diff --git a/docs~/docs/reference/parameters.png b/docs~/docs/reference/parameters.png new file mode 100644 index 00000000..bef9b2af Binary files /dev/null and b/docs~/docs/reference/parameters.png differ diff --git a/docs~/docs/unity-2019/index.md b/docs~/docs/unity-2019/index.md new file mode 100644 index 00000000..50e8456b --- /dev/null +++ b/docs~/docs/unity-2019/index.md @@ -0,0 +1,17 @@ +--- +sidebar_position: 11 +--- + +# Unity 2019 support + +Modular Avatar has begun phasing out support for Unity 2019. While you can still use Modular Avatar on Unity 2019, +new features might not be available for Unity 2019. In a future version, support will be removed; currently, this is +likely to occur at 1.11.0. + +## Differences in Unity 2019 + +The following features behave differently between Unity 2019 and Unity 2022 with Modular Avatar: + +* [MA Parameters](/docs/reference/parameters) has a new UI in 2022. You can find the [documentation for the old UI here](old-parameters.md). + * Because of this, it is not possible to override the default value for a parameter to 0 in 2019 (0 will be treated + as if the default value was unset). diff --git a/docs~/docs/unity-2019/old-parameters.md b/docs~/docs/unity-2019/old-parameters.md new file mode 100644 index 00000000..0be08292 --- /dev/null +++ b/docs~/docs/unity-2019/old-parameters.md @@ -0,0 +1,50 @@ +# MA Parameters (Unity 2019) + +:::info + +The UI for this component has been reimplemented for Unity 2022. See the +[new documentation page](/docs/reference/parameters.md) if you're using a newer version of Unity. + +::: + +The Modular Avatar Parameters component allows you to define the animator parameters your prefab uses either internally, or to communicate with other components. +It allows the end-user to easily rename parameters to avoid conflicts, or to wire up multiple prefabs without having to alter animators directly. +It also allows for automatic configuration of synced parameters. + +The Parameters component has two display modes: One for end-users of prefabs, and one for prefab developers. +End-users can rename fields, and configure their AV3 parameters settings (saved state and default value). +Developers can adjust the sync type and set parameters to be internal/hidden from end-users. + +![End-user display](parameters-enduser.png) ![Developer display](parameters-devmode.png) + +## When should I use it? + +The Parameters component should be used when you're building a prefab which makes use of animator parameters other than VRChat builtins. + +## How do I use it? + +### End-users + +The parameters component on prefabs can be used to rename parameters to avoid conflicts, and to adjust whether synced parameters are saved across avatar reloads (and their default value). +By renaming multiple prefab parameters to be the same, you can make them all share the same state and animate at the same time. +Alternately, by changing conflicting names to be different, you can resolve prefab conflicts. +Finally, you can mark parameters as being unsynced to save on bandwidth, if desired. + +### Prefab developers + +Add the parameters component to the root of your prefab, and click "Show Prefab Developer Options". You'll see a list of all parameters used in your prefab. + +Each parameter can be configured with the following options: + +* Internal - Hides the parameter, and automatically renames the parameter with a unique name. +* PhysBones Prefix - Indicates this is a parameter passed to a PhysBone "parameter" field (and thus it really references a number of sub-parameters) +* Param type - Indicates what type a parameter is, or if it's only present on the animator (and not the Expressions Parameters asset) + +Parameters components can be nested. This lets you build up a complex prefab out of sub-prefabs, some which may be added multiple times, and while avoiding parameter name conflicts. + +Parameter renaming will be applied to the following components underneath (or on the same GameObject as) the Parameters component: +* [Modular Avatar Merge Animator](/docs/reference/merge-animator) +* [Modular Avatar Menu Installer](/docs/reference/menu-installer) +* VRC Physics Bone +* VRC Contact Receiver +* Animator (although this is unlikely to be very useful) diff --git a/docs~/docs/reference/parameters-devmode.png b/docs~/docs/unity-2019/parameters-devmode.png similarity index 100% rename from docs~/docs/reference/parameters-devmode.png rename to docs~/docs/unity-2019/parameters-devmode.png diff --git a/docs~/docs/reference/parameters-enduser.png b/docs~/docs/unity-2019/parameters-enduser.png similarity index 100% rename from docs~/docs/reference/parameters-enduser.png rename to docs~/docs/unity-2019/parameters-enduser.png 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 ef89da58..6df024dc 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 @@ -1,41 +1,70 @@ # Parameters -Parametersコンポーネントでは、アセットが内部で使っている、あるいはほかのアセットとの総合通信に使うアニメーターパラメーターを設定することができます。 -ユーザーが名前かぶりを避けるためにパラメーター名を簡単に変更することができたり、アニメーターを触らずとも二つのアセットを連携できたりします。 -また、同期パラメーターの自動設定もできます。 +Modular AvatarのParameters コンポーネントで、ギミックが内部で使ってたり、外とやり取りするためのパラメーターを定義できます。 +衝突を避けるために名前を変更したり、同期・非同期パラメーターとその初期値を設定できます。 -Parametersコンポーネントに表示モードが二つあります。一つはアセットユーザー向けで、もう一つはアセット作者向けです。 -ユーザーがパラメーターの名前を変えたり、同期パラメーターの保存状態やデフォルト値を設定できます。 -開発者モードでは、同期モードを設定したり、ユーザーが見えないように内部パラメーターとして設定できます。 +![Parameters UI](parameters.png) -![End-user display](parameters-enduser.png) ![Developer display](parameters-devmode.png) ## いつ使うもの? -VRChatの標準パラメーター以外のパラメーターを使ったアセットを作り時は使いましょう。 +VRChatが提供するパラメーター以外の、自分で定義するパラメーターを使うギミックを作る際に使います。 ## 使い方 -### ユーザー向け +### 初期値を設定する -Parametersコンポーネントで名前かぶりを避けるためにパラメーター名を変えたり、アバター読み込みでパラメーターの値が保存されるかを設定できます。 -複数のアセットのパラメーターを同じにすることで、同じ値を共有させて、同時にアニメーションさせることができます。 -また、被る名前を変えることで干渉を避けることもできます。 そして、同期する・しないかも設定できます。 +ParametersのUIは最初はたたんだ状態でパラメーター情報を表示します。この表示では初期値と、アバター変更やワールド移動でで保存されるかを +設定できます。空以外の設定だと、Expressions Parametersに設定された初期値も上書きします。 -### プレハブ開発者向け +複数のMA Parametersで同じパラメーターが設定された場合は、初期値を空欄にするのが便利です。設定されたところだけ初期値に関与します。 +なお、複数のMA Parametersコンポーネントで同じパラメーターの初期値を設定してしまうと初期値が不定になるため注意がでます。 -自分のアセットのルートにParametersを追加し、「プレハブ開発者向け設定を表示」をクリック。アセットで使われるパラメーターのリストが表示されます。 +「保存する」設定に関しては、どれか一つのMA Parametersで有効になっている場合は保存状態となります。しかし、例外もあります。詳しくは +「入れ子にする」に参照。なお、Expressions ParametersとMA Parameters両方に定義される場合は、どちらか(あるいは両方)に「保存する」が +有効になっていると、保存される扱いとなります。 -パラメーターには以下の設定があります。 -* 内部値 - パラメーターを非表示にし、ユニークな名前に自動変更します -* PhysBones前置詞 - この値がPhysBoneのparameter欄に設定されるもので、いくつかのサブパラメーターのくくりであることを示します。 -* パラメーター型 - Expressions Parametersに登録されるかどうかと、値の型を指定します +### 名前を変更 -Parametersコンポーネントは、入れ子式(ネスト状)で使うことができます。複雑なアセットをサブプレハブから構築し、名前かぶりを避けつつ同じプレハブを複数回使ったりすることもできます。 +「名前を変更」欄に新しい名前を入れると、パラメーターのリネームができます。たとえば、「hoge」という名のパラメーターに、「piyo」という +「名前を変更」設定を入れると、MA Parametersコンポーネントのあるオブジェクトとその子では「hoge」として参照できます。その中の +[MA Menu Item](menu-item.md)、[MA Merge Animator](merge-animator.md)、VRChat Contact Receiverなどは「hoge」で扱うわけです。 +しかし、そのオブジェクトの外では、「piyo」として扱われます。 -パラメーターの名前変更は、Parametersコンポーネントと同じオブジェクトとその子に付いている、以下のコンポーネントに適用されます -* [Modular Avatar Merge Animator](merge-animator.md) -* [Modular Avatar Menu Installer](menu-installer.md) -* VRC Physics Bone -* VRC Contact Receiver -* Animator (あまり役に立たないかもしれませんが・・・) +複数のMA Parametersで名前がかぶるように設定すると、一つのギミックで別のギミックを制御するように連動させることができたりします。 +また、「自動リネーム」を設定すれば、Modular Avatarに自動的に衝突しない名前を選択してもらえます。これで意図してない名前の衝突を避ける +ことができます。 + +### パラメーターの新規作成 + +新規のパラメーターを作る方法がふたつです。まず、リストの下の「+」を押してから、作られたパラメーターの左の▶を押して、パラメーター名を +記入することです。 + +また、「未登録パラメーター」のところを開いて登録することもできます。このリストには、このオブジェクトとその子で検出されている未登録 +パラメーターがリストアップされます。「追加」を押せばワンクリックで登録できるし、虫眼鏡牡丹をクリックすると検出された場所が表示されます。 + +どのみち、パラメーターを作ったら▶を押せば詳細画面を開けます。そこで同期状態をつかさどるパラメーター型を設定したり、その他詳細設定ができます。 + +### PhysBoneやContact + +MA ParametersはVRC Phys BoneやContact Receiverコンポーネントにも対応しています。PhysBonesの場合は、VRC Phys Boneコンポーネント +の「Parameter」欄にも登録されている、前置詞をパラメーター名にしてから、「PhysBone前置詞名」を有効にしてください。なお、 +「未登録パラメーター」のリストから追加する場合は自動的に設定されます。 + +### Expression Parameters + +VRC Expression Parametersに登録する場合は、「パラメーター型」を設定してください。ネットワーク経由で同期されるようになり、 +Expressions Menu(アクションメニュー)やOSCで使えるようになります。ネットワーク同期が不要の場合は「Local Only」を設定してくささい。 + +### 入れ子にする + +MA Parametersコンポーネントは入れ子状態にできます。これで複雑なシステムを、複数のモジュールから組み上げることができます。 +MA Parametersコンポーネントはそれぞれ、その子に名前変更を施します。例えば、中のほうのMA Parametersが「hoge」→「piyo」でリネームし、 +外が「piyo」を自動リネームするとしたら、その間のオブジェクトでは「piyo」としてアクセスできます。 + +入れ子にした場合の特別の取り扱いが一部あります。 + +* 「保存する」設定は、親側で登録された設定を優先します。ただし、入れ子になってないMA Parametersで「保存する」設定が異なる場合は、 + どれか一つでも「保存する」が有効になった場合は有効になります。 +* 「初期値」設定は、親側で登録された設定を優先します。ただし、親の設定が空欄の場合は子の設定を考慮する。なお、入れ子になってない状態で + 「初期値」設定が異なる場合は初期値が不定になるため注意が表示されます。 \ No newline at end of file diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.png b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.png new file mode 100644 index 00000000..575a7bd8 Binary files /dev/null and b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters.png differ diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/index.md b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/index.md new file mode 100644 index 00000000..8957ffa8 --- /dev/null +++ b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/index.md @@ -0,0 +1,17 @@ +--- +sidebar_position: 11 +--- + +# Unity 2019 対応について + +Modular Avatar はUnity 2019の対応終了を視野に入れています。現段階ではModular AvatarをUnity 2019で利用できますが、新機能が使えない +場合があります。今後のバージョンでサポートを終了する予定です。終了時期は未定ですが、1.11.0あたりになる可能性が高いです。 + +## Unity 2019での違い + +以下の機能は Unity 2019 と Unity 2022 で挙動が違います。 + +* 2022では、[MA Parameters](/docs/reference/parameters)のUIを更新しています。 + [旧UIのドキュメンテーションページはこちらです。](old-parameters.md) + * Unity 2019ではパラメーターのデフォルト値がゼロの場合、未設定扱いとなります。 + そのため、オーバーライドとしてゼロを設定することができません。 diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/old-parameters.md b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/old-parameters.md new file mode 100644 index 00000000..0dd47b6f --- /dev/null +++ b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/old-parameters.md @@ -0,0 +1,41 @@ +# MA Parameters (Unity 2019) + +Parametersコンポーネントでは、アセットが内部で使っている、あるいはほかのアセットとの総合通信に使うアニメーターパラメーターを設定することができます。 +ユーザーが名前かぶりを避けるためにパラメーター名を簡単に変更することができたり、アニメーターを触らずとも二つのアセットを連携できたりします。 +また、同期パラメーターの自動設定もできます。 + +Parametersコンポーネントに表示モードが二つあります。一つはアセットユーザー向けで、もう一つはアセット作者向けです。 +ユーザーがパラメーターの名前を変えたり、同期パラメーターの保存状態やデフォルト値を設定できます。 +開発者モードでは、同期モードを設定したり、ユーザーが見えないように内部パラメーターとして設定できます。 + +![End-user display](parameters-enduser.png) ![Developer display](parameters-devmode.png) + +## いつ使うもの? + +VRChatの標準パラメーター以外のパラメーターを使ったアセットを作り時は使いましょう。 + +## 使い方 + +### ユーザー向け + +Parametersコンポーネントで名前かぶりを避けるためにパラメーター名を変えたり、アバター読み込みでパラメーターの値が保存されるかを設定できます。 +複数のアセットのパラメーターを同じにすることで、同じ値を共有させて、同時にアニメーションさせることができます。 +また、被る名前を変えることで干渉を避けることもできます。 そして、同期する・しないかも設定できます。 + +### プレハブ開発者向け + +自分のアセットのルートにParametersを追加し、「プレハブ開発者向け設定を表示」をクリック。アセットで使われるパラメーターのリストが表示されます。 + +パラメーターには以下の設定があります。 +* 内部値 - パラメーターを非表示にし、ユニークな名前に自動変更します +* PhysBones前置詞 - この値がPhysBoneのparameter欄に設定されるもので、いくつかのサブパラメーターのくくりであることを示します。 +* パラメーター型 - Expressions Parametersに登録されるかどうかと、値の型を指定します + +Parametersコンポーネントは、入れ子式(ネスト状)で使うことができます。複雑なアセットをサブプレハブから構築し、名前かぶりを避けつつ同じプレハブを複数回使ったりすることもできます。 + +パラメーターの名前変更は、Parametersコンポーネントと同じオブジェクトとその子に付いている、以下のコンポーネントに適用されます +* [Modular Avatar Merge Animator](/docs/reference/merge-animator) +* [Modular Avatar Menu Installer](/docs/reference/menu-installer) +* VRC Physics Bone +* VRC Contact Receiver +* Animator (あまり役に立たないかもしれませんが・・・) \ No newline at end of file diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters-devmode.png b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/parameters-devmode.png similarity index 100% rename from docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters-devmode.png rename to docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/parameters-devmode.png diff --git a/docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters-enduser.png b/docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/parameters-enduser.png similarity index 100% rename from docs~/i18n/ja/docusaurus-plugin-content-docs/current/reference/parameters-enduser.png rename to docs~/i18n/ja/docusaurus-plugin-content-docs/current/unity-2019/parameters-enduser.png