mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-13 16:09:02 +08:00
support VRM0 SpringBone
This commit is contained in:
parent
4fe0d14044
commit
5af7c58feb
@ -7,6 +7,10 @@ using UnityEngine;
|
||||
using VRC.SDK3.Dynamics.PhysBone.Components;
|
||||
#endif
|
||||
|
||||
#if MA_VRM0
|
||||
using VRM;
|
||||
#endif
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
/// <summary>
|
||||
@ -66,6 +70,13 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if MA_VRM0
|
||||
case VRMSpringBone sb:
|
||||
MarkObject(obj);
|
||||
MarkSpringBone(sb);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case AvatarTagComponent _:
|
||||
// Tag components will not be retained at runtime, so pretend they're not there.
|
||||
break;
|
||||
@ -147,6 +158,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MA_VRM0
|
||||
private void MarkSpringBone(VRMSpringBone sb)
|
||||
{
|
||||
foreach (var rootBone in sb.RootBones)
|
||||
{
|
||||
foreach (var obj in GameObjects(rootBone.gameObject))
|
||||
{
|
||||
MarkObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
// Mark etc
|
||||
MarkAllReferencedObjects(sb);
|
||||
}
|
||||
#endif
|
||||
|
||||
private void MarkAllReferencedObjects(Component component)
|
||||
{
|
||||
var so = new SerializedObject(component);
|
||||
|
Loading…
x
Reference in New Issue
Block a user