Merge 88ee50977b4ee571c906ef2e9aecefb29cd6ca73 into 07b648dcc1256ed490356e2e4cebe976555f98ba

This commit is contained in:
kaikoga 2024-10-27 16:08:48 +09:00 committed by GitHub
commit aeae448eca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 114 additions and 61 deletions

View File

@ -159,6 +159,8 @@ namespace nadena.dev.modular_avatar.animation
#if MA_VRCSDK3_AVATARS
var avatarDescriptor = context.AvatarDescriptor;
if (!avatarDescriptor) return;
foreach (var layer in avatarDescriptor.baseAnimationLayers)
{
BootstrapLayer(layer);

View File

@ -53,9 +53,12 @@ namespace nadena.dev.modular_avatar.animation
// This helps reduce the risk that we'll accidentally modify the original assets.
#if MA_VRCSDK3_AVATARS
context.AvatarDescriptor.baseAnimationLayers =
var avatarDescriptor = context.AvatarDescriptor;
if (!avatarDescriptor) return;
avatarDescriptor.baseAnimationLayers =
CloneLayers(context, context.AvatarDescriptor.baseAnimationLayers);
context.AvatarDescriptor.specialAnimationLayers =
avatarDescriptor.specialAnimationLayers =
CloneLayers(context, context.AvatarDescriptor.specialAnimationLayers);
#endif
}

View File

@ -19,6 +19,8 @@ namespace nadena.dev.modular_avatar.core.editor
internal static void FixupExpressionsMenu(BuildContext context)
{
if (!context.AvatarDescriptor) return;
context.AvatarDescriptor.customExpressions = true;
var expressionsMenu = context.AvatarDescriptor.expressionsMenu;

View File

@ -65,6 +65,7 @@ namespace nadena.dev.modular_avatar.core.editor
mergeSessions.Clear();
var descriptor = avatarGameObject.GetComponent<VRCAvatarDescriptor>();
if (!descriptor) return;
if (descriptor.baseAnimationLayers != null) InitSessions(descriptor.baseAnimationLayers);
if (descriptor.specialAnimationLayers != null) InitSessions(descriptor.specialAnimationLayers);

View File

@ -36,6 +36,15 @@ using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor;
using UnityEngine;
using UnityEngine.Animations;
#if MA_VRM0
using VRM;
#endif
#if MA_VRM1
using UniVRM10;
#endif
using Object = UnityEngine.Object;
#endregion
@ -112,6 +121,35 @@ namespace nadena.dev.modular_avatar.core.editor
RetainBoneReferences(c);
#endif
#if MA_VRM0
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRMSpringBone>(true))
{
RetainBoneReferences(c);
}
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRMSpringBoneColliderGroup>(true))
{
RetainBoneReferences(c);
}
#endif
#if MA_VRM1
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRM10SpringBoneJoint>(true))
{
RetainBoneReferences(c);
}
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRM10SpringBoneCollider>(true))
{
RetainBoneReferences(c);
}
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRM10SpringBoneColliderGroup>(true))
{
RetainBoneReferences(c);
}
#endif
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<IConstraint>(true))
{
RetainBoneReferences(c as Component);
@ -480,5 +518,7 @@ namespace nadena.dev.modular_avatar.core.editor
}
}
#endif
// TODO - deduplicate VRM0/1 SpringBone components... doesn't break avatars either
}
}

View File

@ -7,6 +7,10 @@ using Object = UnityEngine.Object;
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);

View File

@ -9,6 +9,8 @@ namespace nadena.dev.modular_avatar.core.editor
{
protected override void Execute(ndmf.BuildContext context)
{
if (!context.AvatarDescriptor) return;
var expParams = context.AvatarDescriptor.expressionParameters;
if (expParams != null && context.IsTemporaryAsset(expParams))
{

View File

@ -182,6 +182,8 @@ namespace nadena.dev.modular_avatar.core.editor
.ToImmutableDictionary();
var avatar = avatarRoot.GetComponent<VRCAvatarDescriptor>();
if (!avatar) return;
var expParams = avatar.expressionParameters;
if (expParams == null)

View File

@ -7,6 +7,9 @@
"VRC.SDKBase",
"nadena.dev.ndmf",
"nadena.dev.ndmf.vrchat",
"VRM",
"VRM10",
"nadena.dev.ndmf.reactive-query.core",
"nadena.dev.ndmf.runtime",
"VRC.SDK3A.Editor",
"Unity.Burst"
@ -44,6 +47,16 @@
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
},
{
"name": "com.vrmc.univrm",
"expression": "",
"define": "MA_VRM0"
},
{
"name": "com.vrmc.vrm",
"expression": "",
"define": "MA_VRM1"
},
{
"name": "com.vrchat.avatars",
"expression": "3.5.2",

View File

@ -1,59 +0,0 @@
{
"name": "nadena.dev.modular-avatar.core.editor",
"rootNamespace": "",
"references": [
"nadena.dev.modular-avatar.core",
"VRC.SDK3A",
"VRC.SDKBase",
"nadena.dev.ndmf",
"nadena.dev.ndmf.vrchat",
"nadena.dev.ndmf.runtime",
"VRC.SDK3A.Editor",
"Unity.Burst"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll",
"System.Collections.Immutable.dll",
"VRCSDKBase.dll",
"VRCSDKBase-Editor.dll",
"VRCSDK3A.dll",
"VRCSDK3A-Editor.dll",
"VRC.Dynamics.dll",
"VRC.SDK3.Dynamics.Contact.dll",
"VRC.SDK3.Dynamics.Contact.Editor.dll",
"VRC.SDK3.Dynamics.PhysBone.dll",
"VRC.SDK3.Dynamics.PhysBone.Editor.dll",
"VRCCore-Editor.dll"
],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.anatawa12.avatar-optimizer",
"expression": "(,1.5.0-rc.8)",
"define": "LEGACY_AVATAR_OPTIMIZER"
},
{
"name": "com.vrchat.avatars",
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
},
{
"name": "com.vrchat.avatars",
"expression": "3.5.2",
"define": "MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER"
},
{
"name": "com.vrchat.avatars",
"expression": "3.7.0-beta.2",
"define": "MA_VRCSDK3_AVATARS_3_7_0_OR_NEWER"
}
],
"noEngineReferences": false
}

View File

@ -24,6 +24,16 @@
"name": "com.vrchat.avatars",
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
},
{
"name": "com.vrmc.univrm",
"expression": "",
"define": "MA_VRM0"
},
{
"name": "com.vrmc.vrm",
"expression": "",
"define": "MA_VRM1"
}
],
"noEngineReferences": false

View File

@ -31,6 +31,16 @@
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
},
{
"name": "com.vrmc.univrm",
"expression": "",
"define": "MA_VRM0"
},
{
"name": "com.vrmc.vrm",
"expression": "",
"define": "MA_VRM1"
},
{
"name": "com.vrchat.avatars",
"expression": "3.5.2",