fix(visible-head-accessory): workaround unity crash

Reported-By: Momishiro
This commit is contained in:
bd_ 2023-01-30 22:55:56 +09:00
parent d6ab6c676f
commit 85617735e9
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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<SkinnedMeshRenderer>(true))
{
new VisibleHeadAccessoryMeshProcessor(smr, _visibleBones, _proxyHead).Retarget();
new VisibleHeadAccessoryMeshProcessor(smr, _visibleBones, _proxyHead).Retarget(context);
}
}
}