diff --git a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs index 81985c7a..e885a050 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs @@ -165,7 +165,7 @@ namespace nadena.dev.modular_avatar.core.editor new MenuInstallHook().OnPreprocessAvatar(avatarGameObject, context); new MergeArmatureHook().OnPreprocessAvatar(context, avatarGameObject); new BoneProxyProcessor().OnPreprocessAvatar(avatarGameObject); - new VisibleHeadAccessoryProcessor(vrcAvatarDescriptor).Process(); + new VisibleHeadAccessoryProcessor(vrcAvatarDescriptor).Process(context); new RemapAnimationPass(vrcAvatarDescriptor).Process(context.AnimationDatabase); new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject, context); PhysboneBlockerPass.Process(avatarGameObject); diff --git a/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs b/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs index fca43a7f..bfe5a322 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs @@ -33,14 +33,14 @@ namespace nadena.dev.modular_avatar.core.editor return _renderer.bones.Any(_visibleBones.Contains) && _renderer.bones.Any(b => !_visibleBones.Contains(b)); } - public void Retarget() + public void Retarget(BuildContext context) { if (!NeedsRetargeting()) return; bool anyVisible = false; var originalMesh = _renderer.sharedMesh; var newMesh = Object.Instantiate(originalMesh); - AssetDatabase.CreateAsset(newMesh, Util.GenerateAssetPath()); + context.SaveAsset(newMesh); // Identify the manifolds which need to be retargeted. Generally, we define a manifold as the maximal set of // points which are connected by primitives. If this manifold contains both visible and retargeted bones, diff --git a/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs b/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs index 07e95827..e2fdc6de 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs @@ -55,7 +55,7 @@ namespace nadena.dev.modular_avatar.core.editor } } - public void Process() + public void Process(BuildContext context) { bool didWork = false; @@ -70,7 +70,7 @@ namespace nadena.dev.modular_avatar.core.editor // Process meshes foreach (var smr in _avatar.GetComponentsInChildren(true)) { - new VisibleHeadAccessoryMeshProcessor(smr, _visibleBones, _proxyHead).Retarget(); + new VisibleHeadAccessoryMeshProcessor(smr, _visibleBones, _proxyHead).Retarget(context); } } }