mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-15 08:59:00 +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;
|
using VRC.SDK3.Dynamics.PhysBone.Components;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MA_VRM0
|
||||||
|
using VRM;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace nadena.dev.modular_avatar.core.editor
|
namespace nadena.dev.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -66,6 +70,13 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MA_VRM0
|
||||||
|
case VRMSpringBone sb:
|
||||||
|
MarkObject(obj);
|
||||||
|
MarkSpringBone(sb);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case AvatarTagComponent _:
|
case AvatarTagComponent _:
|
||||||
// Tag components will not be retained at runtime, so pretend they're not there.
|
// Tag components will not be retained at runtime, so pretend they're not there.
|
||||||
break;
|
break;
|
||||||
@ -147,6 +158,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
private void MarkAllReferencedObjects(Component component)
|
||||||
{
|
{
|
||||||
var so = new SerializedObject(component);
|
var so = new SerializedObject(component);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user