feat: use stable identifiers for MA Menu Items

This commit is contained in:
bd_ 2025-03-29 16:40:54 -07:00
parent b75e74ef84
commit 94e33e1ab2
6 changed files with 14 additions and 12 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
### Changed ### Changed
- [#1530] `MA Menu Item`の自動パラメーター機能も、オブジェクトのパスに基づいて名前を割り当てるようになりました。
### Removed ### Removed

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
### Changed ### Changed
- [#1530] `MA Menu Item` auto parameters now also assign names based on object paths
### Removed ### Removed

View File

@ -27,8 +27,8 @@ Modular Avatarの主な変更点をこのファイルで記録しています。
- [#1513] iOSビルドでエクスプレッションメニューアイコンの圧縮処理が壊れる問題を修正 - [#1513] iOSビルドでエクスプレッションメニューアイコンの圧縮処理が壊れる問題を修正
### Changed ### Changed
- [#1529] `MA Parameters` の自動リネームは、オブジェクトのパスに基づいて新しい名前を割り当てるように変更されました。これにより、 - [#1529] `MA Parameters` の自動リネーム`MA Menu Item` の自動パラメーター機能は、オブジェクトのパスに基づいて名前
`MA Sync Parameter Sequence` との互換性が向上します を割り当てるように変更されました
- `MA Sync Parameter Sequence` を使用している場合は、このバージョンに更新した後、SyncedParamsアセットを空にして、 - `MA Sync Parameter Sequence` を使用している場合は、このバージョンに更新した後、SyncedParamsアセットを空にして、
すべてのプラットフォームを再アップロードすることをお勧めします。 すべてのプラットフォームを再アップロードすることをお勧めします。
- [#1514] `Merge Blend Tree``Merge Motion (Blend Tree)` に改名され、アニメーションクリップにも対応するようになりました - [#1514] `Merge Blend Tree``Merge Motion (Blend Tree)` に改名され、アニメーションクリップにも対応するようになりました

View File

@ -31,8 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1513] Expression menu icon compression broke on iOS builds - [#1513] Expression menu icon compression broke on iOS builds
### Changed ### Changed
- [#1529] `MA Parameters` auto-rename now assigns new names based on the path of the object. This should improve - [#1529] `MA Parameters` auto-rename and `MA Menu Item`'s automatic parameter feature now assign names based on the
compatibility with `MA Sync Parameter Sequence` path of the object. This should improve compatibility with `MA Sync Parameter Sequence`
- If you are using `MA Sync Parameter Sequence`, it's a good idea to empty your SyncedParams asset and reupload all - If you are using `MA Sync Parameter Sequence`, it's a good idea to empty your SyncedParams asset and reupload all
platforms after updating to this version. platforms after updating to this version.
- [#1514] `Merge Blend Tree` is now `Merge Motion (Blend Tree)` and supports merging animation clips as well as blend trees - [#1514] `Merge Blend Tree` is now `Merge Motion (Blend Tree)` and supports merging animation clips as well as blend trees

View File

@ -54,6 +54,7 @@ namespace nadena.dev.modular_avatar.core.editor
if (!context.AvatarDescriptor) return; if (!context.AvatarDescriptor) return;
var paramIndex = 0; var paramIndex = 0;
var mappings = ParameterRenameMappings.Get(context);
var declaredParams = context.AvatarDescriptor.expressionParameters.parameters var declaredParams = context.AvatarDescriptor.expressionParameters.parameters
.GroupBy(p => p.name).Select(l => l.First()) .GroupBy(p => p.name).Select(l => l.First())
@ -72,7 +73,8 @@ namespace nadena.dev.modular_avatar.core.editor
if (mami.Control == null) mami.Control = new VRCExpressionsMenu.Control(); if (mami.Control == null) mami.Control = new VRCExpressionsMenu.Control();
mami.Control.parameter = new VRCExpressionsMenu.Control.Parameter mami.Control.parameter = new VRCExpressionsMenu.Control.Parameter
{ {
name = $"__MA/AutoParam/{mami.gameObject.name}${paramIndex++}" name = mappings.Remap(mami, ParameterNamespace.Animator,
$"__MA/AutoParam/{mami.gameObject.name}")
}; };
} }

View File

@ -19,8 +19,6 @@ using VRC.SDK3.Dynamics.Contact.Components;
using VRC.SDK3.Dynamics.PhysBone.Components; using VRC.SDK3.Dynamics.PhysBone.Components;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
using UnityObject = UnityEngine.Object;
#endregion #endregion
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -33,11 +31,11 @@ namespace nadena.dev.modular_avatar.core.editor
} }
private readonly HashSet<string> usedNames = new(); private readonly HashSet<string> usedNames = new();
public Dictionary<(ModularAvatarParameters, ParameterNamespace, string), string> Remappings = new(); public Dictionary<(Component, ParameterNamespace, string), string> Remappings = new();
private int internalParamIndex; private int internalParamIndex;
public string Remap(ModularAvatarParameters p, ParameterNamespace ns, string s) public string Remap(Component p, ParameterNamespace ns, string s)
{ {
var tuple = (p, ns, s); var tuple = (p, ns, s);
@ -96,8 +94,8 @@ namespace nadena.dev.modular_avatar.core.editor
private static long encounterOrderCounter; private static long encounterOrderCounter;
public ParameterConfig ResolvedParameter; public ParameterConfig ResolvedParameter;
public List<UnityObject> TypeSources = new List<UnityObject>(); public List<Object> TypeSources = new List<Object>();
public List<UnityObject> DefaultSources = new List<UnityObject>(); public List<Object> DefaultSources = new List<Object>();
public ImmutableHashSet<float> ConflictingValues = ImmutableHashSet<float>.Empty; public ImmutableHashSet<float> ConflictingValues = ImmutableHashSet<float>.Empty;
public ImmutableHashSet<ParameterSyncType> ConflictingSyncTypes = ImmutableHashSet<ParameterSyncType>.Empty; public ImmutableHashSet<ParameterSyncType> ConflictingSyncTypes = ImmutableHashSet<ParameterSyncType>.Empty;
@ -197,7 +195,7 @@ namespace nadena.dev.modular_avatar.core.editor
// clean up all parameters objects before the ParameterAssignerPass runs // clean up all parameters objects before the ParameterAssignerPass runs
foreach (var p in avatar.GetComponentsInChildren<ModularAvatarParameters>()) foreach (var p in avatar.GetComponentsInChildren<ModularAvatarParameters>())
UnityObject.DestroyImmediate(p); Object.DestroyImmediate(p);
} }
private void SetExpressionParameters(GameObject avatarRoot, ImmutableDictionary<string, ParameterInfo> allParams) private void SetExpressionParameters(GameObject avatarRoot, ImmutableDictionary<string, ParameterInfo> allParams)