chore: Wrap VRC dependencies and VRCAvatarDescriptors (#504)

* add version defines

* refactor: prefer BuildContext.ctor() overload taking GameObject

* wrap unit tests entirely with MA_VRCSDK3_AVATARS

* wrap unit tests smart with MA_VRCSDK3_AVATARS

* wrap runtime entirely with MA_VRCSDK3_AVATARS

* wrap VRC.SDKBase.IEditorOnly with MA_VRCSDK3_AVATARS

* wrap editor entirely with MA_VRCSDK3_AVATARS

* fix AvatarObjectReference.Get(Component)

* wrap editor smart with MA_VRCSDK3_AVATARS

* wrap BuildContext smart with MA_VRCSDK3_AVATARS

* wrap PluginDefinition smart with MA_VRCSDK3_AVATARS

* style: move conditional compiles one step outside
This commit is contained in:
kaikoga 2023-11-10 15:37:56 +09:00 committed by GitHub
parent 3a34079aef
commit 3667dc319a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 422 additions and 128 deletions

View File

@ -4,7 +4,6 @@ using System.Linq;
using nadena.dev.modular_avatar.animation; using nadena.dev.modular_avatar.animation;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor

View File

@ -7,7 +7,11 @@ using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.animation namespace nadena.dev.modular_avatar.animation
@ -110,6 +114,7 @@ namespace nadena.dev.modular_avatar.animation
AnimationUtil.CloneAllControllers(context); AnimationUtil.CloneAllControllers(context);
#if MA_VRCSDK3_AVATARS
var avatarDescriptor = context.AvatarDescriptor; var avatarDescriptor = context.AvatarDescriptor;
foreach (var layer in avatarDescriptor.baseAnimationLayers) foreach (var layer in avatarDescriptor.baseAnimationLayers)
@ -136,6 +141,7 @@ namespace nadena.dev.modular_avatar.animation
}); });
} }
} }
#endif
} }
/// <summary> /// <summary>

View File

@ -6,7 +6,10 @@ using nadena.dev.ndmf;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
#endregion #endregion
@ -47,12 +50,15 @@ namespace nadena.dev.modular_avatar.animation
// Ensure all of the controllers on the avatar descriptor point to temporary assets. // Ensure all of the controllers on the avatar descriptor point to temporary assets.
// This helps reduce the risk that we'll accidentally modify the original assets. // This helps reduce the risk that we'll accidentally modify the original assets.
#if MA_VRCSDK3_AVATARS
context.AvatarDescriptor.baseAnimationLayers = context.AvatarDescriptor.baseAnimationLayers =
CloneLayers(context, context.AvatarDescriptor.baseAnimationLayers); CloneLayers(context, context.AvatarDescriptor.baseAnimationLayers);
context.AvatarDescriptor.specialAnimationLayers = context.AvatarDescriptor.specialAnimationLayers =
CloneLayers(context, context.AvatarDescriptor.specialAnimationLayers); CloneLayers(context, context.AvatarDescriptor.specialAnimationLayers);
#endif
} }
#if MA_VRCSDK3_AVATARS
private static VRCAvatarDescriptor.CustomAnimLayer[] CloneLayers( private static VRCAvatarDescriptor.CustomAnimLayer[] CloneLayers(
BuildContext context, BuildContext context,
VRCAvatarDescriptor.CustomAnimLayer[] layers VRCAvatarDescriptor.CustomAnimLayer[] layers
@ -167,6 +173,7 @@ namespace nadena.dev.modular_avatar.animation
return controller; return controller;
} }
#endif
public static bool IsProxyAnimation(this Motion m) public static bool IsProxyAnimation(this Motion m)
{ {

View File

@ -31,7 +31,11 @@ using nadena.dev.modular_avatar.core.editor;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
#endregion #endregion
@ -275,6 +279,7 @@ namespace nadena.dev.modular_avatar.animation
private void AdjustBehavior(StateMachineBehaviour behavior) private void AdjustBehavior(StateMachineBehaviour behavior)
{ {
#if MA_VRCSDK3_AVATARS
switch (behavior) switch (behavior)
{ {
case VRCAnimatorLayerControl layerControl: case VRCAnimatorLayerControl layerControl:
@ -285,6 +290,7 @@ namespace nadena.dev.modular_avatar.animation
break; break;
} }
} }
#endif
} }
private static string MapPath(EditorCurveBinding binding, string basePath) private static string MapPath(EditorCurveBinding binding, string basePath)

View File

@ -29,7 +29,11 @@ using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -254,6 +258,7 @@ namespace nadena.dev.modular_avatar.core.editor
private void AdjustBehavior(StateMachineBehaviour behavior) private void AdjustBehavior(StateMachineBehaviour behavior)
{ {
#if MA_VRCSDK3_AVATARS
switch (behavior) switch (behavior)
{ {
case VRCAnimatorLayerControl layerControl: case VRCAnimatorLayerControl layerControl:
@ -264,6 +269,7 @@ namespace nadena.dev.modular_avatar.core.editor
break; break;
} }
} }
#endif
} }
private static string MapPath(EditorCurveBinding binding, string basePath) private static string MapPath(EditorCurveBinding binding, string basePath)

View File

@ -1,4 +1,6 @@
using System.Collections.Generic; #if MA_VRCSDK3_AVATARS
using System.Collections.Generic;
using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
@ -227,4 +229,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -4,8 +4,12 @@ using nadena.dev.modular_avatar.animation;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Avatars.ScriptableObjects;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -14,7 +18,9 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
internal readonly nadena.dev.ndmf.BuildContext PluginBuildContext; internal readonly nadena.dev.ndmf.BuildContext PluginBuildContext;
#if MA_VRCSDK3_AVATARS
internal VRCAvatarDescriptor AvatarDescriptor => PluginBuildContext.AvatarDescriptor; internal VRCAvatarDescriptor AvatarDescriptor => PluginBuildContext.AvatarDescriptor;
#endif
internal GameObject AvatarRootObject => PluginBuildContext.AvatarRootObject; internal GameObject AvatarRootObject => PluginBuildContext.AvatarRootObject;
internal Transform AvatarRootTransform => PluginBuildContext.AvatarRootTransform; internal Transform AvatarRootTransform => PluginBuildContext.AvatarRootTransform;
@ -28,12 +34,10 @@ namespace nadena.dev.modular_avatar.core.editor
private bool SaveImmediate = false; private bool SaveImmediate = false;
#if MA_VRCSDK3_AVATARS
internal readonly Dictionary<VRCExpressionsMenu, VRCExpressionsMenu> ClonedMenus internal readonly Dictionary<VRCExpressionsMenu, VRCExpressionsMenu> ClonedMenus
= new Dictionary<VRCExpressionsMenu, VRCExpressionsMenu>(); = new Dictionary<VRCExpressionsMenu, VRCExpressionsMenu>();
public static implicit operator BuildContext(ndmf.BuildContext ctx) =>
ctx.Extension<ModularAvatarContext>().BuildContext;
/// <summary> /// <summary>
/// This dictionary overrides the _original contents_ of ModularAvatarMenuInstallers. Notably, this does not /// This dictionary overrides the _original contents_ of ModularAvatarMenuInstallers. Notably, this does not
/// replace the source menu for the purposes of identifying any other MAMIs that might install to the same /// replace the source menu for the purposes of identifying any other MAMIs that might install to the same
@ -41,16 +45,21 @@ namespace nadena.dev.modular_avatar.core.editor
/// </summary> /// </summary>
internal readonly Dictionary<ModularAvatarMenuInstaller, Action<VRCExpressionsMenu.Control>> PostProcessControls internal readonly Dictionary<ModularAvatarMenuInstaller, Action<VRCExpressionsMenu.Control>> PostProcessControls
= new Dictionary<ModularAvatarMenuInstaller, Action<VRCExpressionsMenu.Control>>(); = new Dictionary<ModularAvatarMenuInstaller, Action<VRCExpressionsMenu.Control>>();
#endif
public static implicit operator BuildContext(ndmf.BuildContext ctx) =>
ctx.Extension<ModularAvatarContext>().BuildContext;
public BuildContext(nadena.dev.ndmf.BuildContext PluginBuildContext) public BuildContext(nadena.dev.ndmf.BuildContext PluginBuildContext)
{ {
this.PluginBuildContext = PluginBuildContext; this.PluginBuildContext = PluginBuildContext;
} }
#if MA_VRCSDK3_AVATARS
public BuildContext(VRCAvatarDescriptor avatarDescriptor) public BuildContext(VRCAvatarDescriptor avatarDescriptor)
: this(new ndmf.BuildContext(avatarDescriptor, null)) : this(new ndmf.BuildContext(avatarDescriptor, null))
{ {
} }
#endif
public BuildContext(GameObject avatarGameObject) public BuildContext(GameObject avatarGameObject)
: this(new ndmf.BuildContext(avatarGameObject, null)) : this(new ndmf.BuildContext(avatarGameObject, null))
@ -108,6 +117,7 @@ namespace nadena.dev.modular_avatar.core.editor
return merger.Finish(); return merger.Finish();
} }
#if MA_VRCSDK3_AVATARS
public VRCExpressionsMenu CloneMenu(VRCExpressionsMenu menu) public VRCExpressionsMenu CloneMenu(VRCExpressionsMenu menu)
{ {
if (menu == null) return null; if (menu == null) return null;
@ -126,5 +136,6 @@ namespace nadena.dev.modular_avatar.core.editor
return newMenu; return newMenu;
} }
#endif
} }
} }

View File

@ -1,6 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using nadena.dev.modular_avatar.core; using nadena.dev.modular_avatar.core;
#if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.menu; using nadena.dev.modular_avatar.core.menu;
#endif
using UnityEngine; using UnityEngine;
namespace nadena.dev.modular_avatar.editor.ErrorReporting namespace nadena.dev.modular_avatar.editor.ErrorReporting
@ -20,10 +24,12 @@ namespace nadena.dev.modular_avatar.editor.ErrorReporting
return CheckInternal(bs); return CheckInternal(bs);
case ModularAvatarBoneProxy bp: case ModularAvatarBoneProxy bp:
return CheckInternal(bp); return CheckInternal(bp);
#if MA_VRCSDK3_AVATARS
case ModularAvatarMenuInstaller mi: case ModularAvatarMenuInstaller mi:
return CheckInternal(mi); return CheckInternal(mi);
case ModularAvatarMergeAnimator obj: case ModularAvatarMergeAnimator obj:
return CheckInternal(obj); return CheckInternal(obj);
#endif
case ModularAvatarMergeArmature obj: case ModularAvatarMergeArmature obj:
return CheckInternal(obj); return CheckInternal(obj);
default: default:
@ -134,6 +140,7 @@ namespace nadena.dev.modular_avatar.editor.ErrorReporting
return null; return null;
} }
#if MA_VRCSDK3_AVATARS
private static List<ErrorLog> CheckInternal(ModularAvatarMenuInstaller mi) private static List<ErrorLog> CheckInternal(ModularAvatarMenuInstaller mi)
{ {
// TODO - check that target menu is in the avatar // TODO - check that target menu is in the avatar
@ -160,6 +167,7 @@ namespace nadena.dev.modular_avatar.editor.ErrorReporting
return null; return null;
} }
#endif
private static List<ErrorLog> CheckInternal(ModularAvatarMergeArmature ma) private static List<ErrorLog> CheckInternal(ModularAvatarMergeArmature ma)
{ {

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -157,4 +159,6 @@ namespace nadena.dev.modular_avatar.core.editor
return name.StartsWith("DXT") || name.StartsWith("ASTC"); return name.StartsWith("DXT") || name.StartsWith("ASTC");
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -476,4 +478,6 @@ namespace nadena.dev.modular_avatar.core.editor
Localization.ShowLanguageUI(); Localization.ShowLanguageUI();
} }
} }
} }
#endif

View File

@ -3,7 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Avatars.ScriptableObjects;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -31,8 +35,10 @@ namespace nadena.dev.modular_avatar.core.editor
typeof(Mesh), typeof(Mesh),
typeof(AnimationClip), typeof(AnimationClip),
typeof(RuntimeAnimatorController), typeof(RuntimeAnimatorController),
#if MA_VRCSDK3_AVATARS
typeof(VRCExpressionParameters), typeof(VRCExpressionParameters),
typeof(VRCExpressionsMenu), typeof(VRCExpressionsMenu),
#endif
}; };
private Dictionary<UnityEngine.Object, AssetInfo> _assets; private Dictionary<UnityEngine.Object, AssetInfo> _assets;
@ -60,10 +66,15 @@ namespace nadena.dev.modular_avatar.core.editor
public void PopulateReferences(Dictionary<UnityEngine.Object, AssetInfo> assets) public void PopulateReferences(Dictionary<UnityEngine.Object, AssetInfo> assets)
{ {
if (Asset is Mesh || Asset is AnimationClip || Asset is VRCExpressionsMenu || switch (Asset)
Asset is VRCExpressionsMenu)
{ {
return; // No child objects case Mesh _:
case AnimationClip _:
#if MA_VRCSDK3_AVATARS
case VRCExpressionsMenu _:
case VRCExpressionParameters _:
#endif
return; // No child objects
} }
var so = new SerializedObject(Asset); var so = new SerializedObject(Asset);

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -231,4 +233,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using UnityEditor; #if MA_VRCSDK3_AVATARS
using UnityEditor;
using static nadena.dev.modular_avatar.core.editor.Localization; using static nadena.dev.modular_avatar.core.editor.Localization;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -52,4 +54,6 @@ namespace nadena.dev.modular_avatar.core.editor
ShowLanguageUI(); ShowLanguageUI();
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using UnityEditor; #if MA_VRCSDK3_AVATARS
using UnityEditor;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
@ -13,4 +15,6 @@ namespace nadena.dev.modular_avatar.core.editor
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -585,4 +587,6 @@ namespace nadena.dev.modular_avatar.core.editor
return ValidateExpressionMenuIconResult.Success; return ValidateExpressionMenuIconResult.Success;
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using nadena.dev.modular_avatar.core.menu; using nadena.dev.modular_avatar.core.menu;
@ -488,4 +490,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using nadena.dev.modular_avatar.core.menu; using nadena.dev.modular_avatar.core.menu;
using static nadena.dev.modular_avatar.core.editor.Localization; using static nadena.dev.modular_avatar.core.editor.Localization;
@ -273,4 +275,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
@ -283,4 +285,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using UnityEditor; #if MA_VRCSDK3_AVATARS
using UnityEditor;
using static nadena.dev.modular_avatar.core.editor.Localization; using static nadena.dev.modular_avatar.core.editor.Localization;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -45,4 +47,6 @@ namespace nadena.dev.modular_avatar.core.editor
ShowLanguageUI(); ShowLanguageUI();
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System.Linq; #if MA_VRCSDK3_AVATARS
using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -128,4 +130,6 @@ namespace nadena.dev.modular_avatar.core.editor
}; };
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -477,4 +479,6 @@ namespace nadena.dev.modular_avatar.core.editor.menu
return _visitedNodes.Contains(item); return _visitedNodes.Contains(item);
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using nadena.dev.modular_avatar.core.editor.menu; using nadena.dev.modular_avatar.core.editor.menu;
@ -84,4 +86,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -22,6 +22,8 @@
* SOFTWARE. * SOFTWARE.
*/ */
#if MA_VRCSDK3_AVATARS
using System.Collections.Generic; using System.Collections.Generic;
using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor; using UnityEditor;
@ -247,4 +249,6 @@ namespace nadena.dev.modular_avatar.core.editor
return controller; return controller;
} }
} }
} }
#endif

View File

@ -30,8 +30,12 @@ using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.Animations; using UnityEngine.Animations;
#if MA_VRCSDK3_AVATARS
using VRC.Dynamics; using VRC.Dynamics;
using VRC.SDK3.Dynamics.PhysBone.Components; using VRC.SDK3.Dynamics.PhysBone.Components;
#endif
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
@ -71,6 +75,7 @@ namespace nadena.dev.modular_avatar.core.editor
TopoProcessMergeArmatures(mergeArmatures); TopoProcessMergeArmatures(mergeArmatures);
#if MA_VRCSDK3_AVATARS
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRCPhysBone>(true)) foreach (var c in avatarGameObject.transform.GetComponentsInChildren<VRCPhysBone>(true))
{ {
if (c.rootTransform == null) c.rootTransform = c.transform; if (c.rootTransform == null) c.rootTransform = c.transform;
@ -88,6 +93,7 @@ namespace nadena.dev.modular_avatar.core.editor
if (c.rootTransform == null) c.rootTransform = c.transform; if (c.rootTransform == null) c.rootTransform = c.transform;
RetainBoneReferences(c); RetainBoneReferences(c);
} }
#endif
foreach (var c in avatarGameObject.transform.GetComponentsInChildren<IConstraint>(true)) foreach (var c in avatarGameObject.transform.GetComponentsInChildren<IConstraint>(true))
{ {
@ -176,7 +182,9 @@ namespace nadena.dev.modular_avatar.core.editor
mergedObjects.Clear(); mergedObjects.Clear();
thisPassAdded.Clear(); thisPassAdded.Clear();
MergeArmature(config, target); MergeArmature(config, target);
#if MA_VRCSDK3_AVATARS
PruneDuplicatePhysBones(); PruneDuplicatePhysBones();
#endif
UnityEngine.Object.DestroyImmediate(config); UnityEngine.Object.DestroyImmediate(config);
}); });
} }
@ -386,6 +394,7 @@ namespace nadena.dev.modular_avatar.core.editor
return merged; return merged;
} }
#if MA_VRCSDK3_AVATARS
/** /**
* Sometimes outfit authors copy the entire armature, including PhysBones components. If we merge these and * Sometimes outfit authors copy the entire armature, including PhysBones components. If we merge these and
* end up with multiple PB components referencing the same target, PB refuses to animate the bone. So detect * end up with multiple PB components referencing the same target, PB refuses to animate the bone. So detect
@ -425,5 +434,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
#endif
} }
} }

View File

@ -22,7 +22,7 @@ namespace nadena.dev.modular_avatar.core.editor
public void OnPreprocessAvatar() public void OnPreprocessAvatar()
{ {
foreach (var mesh in context.AvatarDescriptor.GetComponentsInChildren<Renderer>(true)) foreach (var mesh in context.AvatarRootObject.GetComponentsInChildren<Renderer>(true))
{ {
ProcessMesh(mesh); ProcessMesh(mesh);
} }
@ -94,7 +94,7 @@ namespace nadena.dev.modular_avatar.core.editor
private void ProcessMesh(Renderer mesh) private void ProcessMesh(Renderer mesh)
{ {
MergedSettings settings = MergeSettings(context.AvatarDescriptor.transform, mesh.transform); MergedSettings settings = MergeSettings(context.AvatarRootTransform, mesh.transform);
if (settings.SetAnchor) if (settings.SetAnchor)
{ {

View File

@ -2,7 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Dynamics.PhysBone.Components; using VRC.SDK3.Dynamics.PhysBone.Components;
#endif
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
@ -56,10 +59,12 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
case Transform t: break; case Transform t: break;
#if MA_VRCSDK3_AVATARS
case VRCPhysBone pb: case VRCPhysBone pb:
MarkObject(obj); MarkObject(obj);
MarkPhysBone(pb); MarkPhysBone(pb);
break; 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.
@ -123,6 +128,7 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
#if MA_VRCSDK3_AVATARS
private void MarkPhysBone(VRCPhysBone pb) private void MarkPhysBone(VRCPhysBone pb)
{ {
var rootTransform = pb.GetRootTransform(); var rootTransform = pb.GetRootTransform();
@ -137,6 +143,7 @@ namespace nadena.dev.modular_avatar.core.editor
// Mark colliders, etc // Mark colliders, etc
MarkAllReferencedObjects(pb); MarkAllReferencedObjects(pb);
} }
#endif
private void MarkAllReferencedObjects(Component component) private void MarkAllReferencedObjects(Component component)
{ {

View File

@ -1,4 +1,6 @@
using System.Collections.Generic; #if MA_VRCSDK3_AVATARS
using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
using UnityEditor.Animations; using UnityEditor.Animations;
@ -319,4 +321,6 @@ namespace nadena.dev.modular_avatar.core.editor
parameters = newParams; parameters = newParams;
} }
} }
} }
#endif

View File

@ -1,18 +1,18 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2022 bd_ * Copyright (c) 2022 bd_
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -22,6 +22,8 @@
* SOFTWARE. * SOFTWARE.
*/ */
#if MA_VRCSDK3_AVATARS
using System.Collections.Generic; using System.Collections.Generic;
using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEngine; using UnityEngine;
@ -75,4 +77,6 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -33,9 +33,11 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
{ {
seq.Run(ClearEditorOnlyTags.Instance); seq.Run(ClearEditorOnlyTags.Instance);
seq.Run(MeshSettingsPluginPass.Instance); seq.Run(MeshSettingsPluginPass.Instance);
#if MA_VRCSDK3_AVATARS
seq.Run(RenameParametersPluginPass.Instance); seq.Run(RenameParametersPluginPass.Instance);
seq.Run(MergeAnimatorPluginPass.Instance); seq.Run(MergeAnimatorPluginPass.Instance);
seq.Run(MenuInstallPluginPass.Instance); seq.Run(MenuInstallPluginPass.Instance);
#endif
seq.WithRequiredExtension(typeof(AnimationServicesContext), _s2 => seq.WithRequiredExtension(typeof(AnimationServicesContext), _s2 =>
{ {
seq.Run(MergeArmaturePluginPass.Instance); seq.Run(MergeArmaturePluginPass.Instance);
@ -45,14 +47,18 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
ctx => new WorldFixedObjectProcessor().Process(ctx) ctx => new WorldFixedObjectProcessor().Process(ctx)
); );
seq.Run(ReplaceObjectPluginPass.Instance); seq.Run(ReplaceObjectPluginPass.Instance);
#if MA_VRCSDK3_AVATARS
seq.Run(BlendshapeSyncAnimationPluginPass.Instance); seq.Run(BlendshapeSyncAnimationPluginPass.Instance);
#endif
}); });
#if MA_VRCSDK3_AVATARS
seq.Run(PhysbonesBlockerPluginPass.Instance); seq.Run(PhysbonesBlockerPluginPass.Instance);
seq.Run("Fixup Expressions Menu", ctx => seq.Run("Fixup Expressions Menu", ctx =>
{ {
var maContext = ctx.Extension<ModularAvatarContext>().BuildContext; var maContext = ctx.Extension<ModularAvatarContext>().BuildContext;
FixupExpressionsMenuPass.FixupExpressionsMenu(maContext); FixupExpressionsMenuPass.FixupExpressionsMenu(maContext);
}); });
#endif
seq.Run("Rebind humanoid avatar", ctx => seq.Run("Rebind humanoid avatar", ctx =>
{ {
// workaround problem with avatar matching // workaround problem with avatar matching
@ -142,6 +148,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
} }
} }
#if MA_VRCSDK3_AVATARS
class RenameParametersPluginPass : MAPass<RenameParametersPluginPass> class RenameParametersPluginPass : MAPass<RenameParametersPluginPass>
{ {
protected override void Execute(ndmf.BuildContext context) protected override void Execute(ndmf.BuildContext context)
@ -165,6 +172,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
new MenuInstallHook().OnPreprocessAvatar(context.AvatarRootObject, MAContext(context)); new MenuInstallHook().OnPreprocessAvatar(context.AvatarRootObject, MAContext(context));
} }
} }
#endif
class MergeArmaturePluginPass : MAPass<MergeArmaturePluginPass> class MergeArmaturePluginPass : MAPass<MergeArmaturePluginPass>
{ {
@ -198,6 +206,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
} }
} }
#if MA_VRCSDK3_AVATARS
class BlendshapeSyncAnimationPluginPass : MAPass<BlendshapeSyncAnimationPluginPass> class BlendshapeSyncAnimationPluginPass : MAPass<BlendshapeSyncAnimationPluginPass>
{ {
protected override void Execute(ndmf.BuildContext context) protected override void Execute(ndmf.BuildContext context)
@ -213,6 +222,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
PhysboneBlockerPass.Process(context.AvatarRootObject); PhysboneBlockerPass.Process(context.AvatarRootObject);
} }
} }
#endif
class GCGameObjectsPluginPass : MAPass<GCGameObjectsPluginPass> class GCGameObjectsPluginPass : MAPass<GCGameObjectsPluginPass>
{ {

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -63,4 +65,6 @@ namespace nadena.dev.modular_avatar.core.editor
return true; return true;
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@ -493,4 +495,6 @@ namespace nadena.dev.modular_avatar.core.editor
return x; return x;
} }
} }
} }
#endif

View File

@ -29,9 +29,9 @@ namespace nadena.dev.modular_avatar.core.editor
public void Process() public void Process()
{ {
var avatarDescriptor = _buildContext.AvatarDescriptor; var avatarRootTransform = _buildContext.AvatarRootTransform;
var replacementComponents = var replacementComponents =
avatarDescriptor.GetComponentsInChildren<ModularAvatarReplaceObject>(true); avatarRootTransform.GetComponentsInChildren<ModularAvatarReplaceObject>(true);
if (replacementComponents.Length == 0) return; if (replacementComponents.Length == 0) return;
@ -43,7 +43,7 @@ namespace nadena.dev.modular_avatar.core.editor
foreach (var component in replacementComponents) foreach (var component in replacementComponents)
{ {
var targetObject = component.targetObject?.Get(_buildContext.AvatarDescriptor); var targetObject = component.targetObject?.Get(avatarRootTransform);
if (targetObject == null) if (targetObject == null)
{ {
@ -154,7 +154,7 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
Dictionary<UnityObject, List<Reference>> refIndex = new Dictionary<UnityObject, List<Reference>>(); Dictionary<UnityObject, List<Reference>> refIndex = new Dictionary<UnityObject, List<Reference>>();
IndexObject(_buildContext.AvatarDescriptor.gameObject); IndexObject(_buildContext.AvatarRootObject);
return refIndex; return refIndex;

View File

@ -28,7 +28,7 @@ using System.Reflection;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
using VRC.SDKBase.Editor.BuildPipeline;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor

View File

@ -2,7 +2,10 @@
using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEngine; using UnityEngine;
using UnityEngine.Animations; using UnityEngine.Animations;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Dynamics.PhysBone.Components; using VRC.SDK3.Dynamics.PhysBone.Components;
#endif
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
@ -34,6 +37,7 @@ namespace nadena.dev.modular_avatar.core.editor
var animator = _avatarTransform.GetComponent<Animator>(); var animator = _avatarTransform.GetComponent<Animator>();
_headBone = animator != null ? animator.GetBoneTransform(HumanBodyBones.Head) : null; _headBone = animator != null ? animator.GetBoneTransform(HumanBodyBones.Head) : null;
#if MA_VRCSDK3_AVATARS
foreach (var physBone in _avatarTransform.GetComponentsInChildren<VRCPhysBone>(true)) foreach (var physBone in _avatarTransform.GetComponentsInChildren<VRCPhysBone>(true))
{ {
var boneRoot = physBone.rootTransform != null ? physBone.rootTransform : physBone.transform; var boneRoot = physBone.rootTransform != null ? physBone.rootTransform : physBone.transform;
@ -55,6 +59,7 @@ namespace nadena.dev.modular_avatar.core.editor
Traverse(child, ignored); Traverse(child, ignored);
} }
} }
#endif
} }
public void Process() public void Process()

View File

@ -33,6 +33,11 @@
"name": "com.anatawa12.avatar-optimizer", "name": "com.anatawa12.avatar-optimizer",
"expression": "(,1.5.0-rc.8)", "expression": "(,1.5.0-rc.8)",
"define": "LEGACY_AVATAR_OPTIMIZER" "define": "LEGACY_AVATAR_OPTIMIZER"
},
{
"name": "com.vrchat.avatars",
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
} }
], ],
"noEngineReferences": false "noEngineReferences": false

View File

@ -1,7 +1,10 @@
#if UNITY_EDITOR #if UNITY_EDITOR
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDKBase; using VRC.SDKBase;
#endif
namespace nadena.dev.modular_avatar.core namespace nadena.dev.modular_avatar.core
{ {

View File

@ -24,7 +24,10 @@
using System; using System;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDKBase; using VRC.SDKBase;
#endif
namespace nadena.dev.modular_avatar.core namespace nadena.dev.modular_avatar.core
{ {
@ -55,4 +58,15 @@ namespace nadena.dev.modular_avatar.core
{ {
} }
} }
#if !MA_VRCSDK3_AVATARS
/**
* Placeholder of VRC.SDKBase.IEditorOnly for environments without VRCSDK
*/
interface IEditorOnly
{
}
#endif
} }

View File

@ -3,7 +3,10 @@ using System.Collections.Generic;
using nadena.dev.modular_avatar.core.armature_lock; using nadena.dev.modular_avatar.core.armature_lock;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDKBase; using VRC.SDKBase;
#endif
namespace nadena.dev.modular_avatar.core.ArmatureAwase namespace nadena.dev.modular_avatar.core.ArmatureAwase
{ {

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.menu; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.menu;
using UnityEngine; using UnityEngine;
namespace nadena.dev.modular_avatar.core namespace nadena.dev.modular_avatar.core
@ -19,4 +21,6 @@ namespace nadena.dev.modular_avatar.core
// no-op // no-op
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using UnityEngine; #if MA_VRCSDK3_AVATARS
using UnityEngine;
using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Avatars.ScriptableObjects;
namespace nadena.dev.modular_avatar.core namespace nadena.dev.modular_avatar.core
@ -29,4 +31,6 @@ namespace nadena.dev.modular_avatar.core
// no-op // no-op
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
@ -172,4 +174,6 @@ namespace nadena.dev.modular_avatar.core.menu
public abstract void Visit(NodeContext context); public abstract void Visit(NodeContext context);
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.menu; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.menu;
using UnityEngine; using UnityEngine;
namespace nadena.dev.modular_avatar.core namespace nadena.dev.modular_avatar.core
@ -29,4 +31,6 @@ namespace nadena.dev.modular_avatar.core
// no-op // no-op
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.menu; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.menu;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Avatars.ScriptableObjects;
@ -76,4 +78,6 @@ namespace nadena.dev.modular_avatar.core
context.PushControl(cloned); context.PushControl(cloned);
} }
} }
} }
#endif

View File

@ -22,6 +22,8 @@
* SOFTWARE. * SOFTWARE.
*/ */
#if MA_VRCSDK3_AVATARS
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -48,4 +50,6 @@ namespace nadena.dev.modular_avatar.core
// no-op // no-op
} }
} }
} }
#endif

View File

@ -26,7 +26,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using JetBrains.Annotations; using JetBrains.Annotations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
#if UNITY_EDITOR #if UNITY_EDITOR
using System.Reflection; using System.Reflection;
#endif #endif
@ -77,6 +81,7 @@ namespace nadena.dev.modular_avatar.core
return ndmf.runtime.RuntimeUtil.IsAvatarRoot(target); return ndmf.runtime.RuntimeUtil.IsAvatarRoot(target);
} }
#if MA_VRCSDK3_AVATARS
public static VRCAvatarDescriptor FindAvatarInParents(Transform target) public static VRCAvatarDescriptor FindAvatarInParents(Transform target)
{ {
while (target != null) while (target != null)
@ -88,6 +93,7 @@ namespace nadena.dev.modular_avatar.core
return null; return null;
} }
#endif
public static Transform FindAvatarTransformInParents(Transform target) public static Transform FindAvatarTransformInParents(Transform target)
{ {

View File

@ -17,6 +17,12 @@
], ],
"autoReferenced": true, "autoReferenced": true,
"defineConstraints": [], "defineConstraints": [],
"versionDefines": [], "versionDefines": [
{
"name": "com.vrchat.avatars",
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
}
],
"noEngineReferences": false "noEngineReferences": false
} }

View File

@ -1,10 +1,11 @@
#if MA_VRCSDK3_AVATARS
using modular_avatar_tests; using modular_avatar_tests;
using nadena.dev.modular_avatar.animation; using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
public class ActiveAnimationRetargeterTests : TestBase public class ActiveAnimationRetargeterTests : TestBase
{ {
@ -12,10 +13,9 @@ public class ActiveAnimationRetargeterTests : TestBase
public void SimpleRetarget() public void SimpleRetarget()
{ {
var avatar = CreatePrefab("SimpleRetarget.prefab"); var avatar = CreatePrefab("SimpleRetarget.prefab");
var descriptor = avatar.GetComponent<VRCAvatarDescriptor>();
// initialize context // initialize context
var buildContext = new BuildContext(descriptor); var buildContext = new BuildContext(avatar);
var pathMappings = buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>() var pathMappings = buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>()
.PathMappings; .PathMappings;
@ -41,4 +41,6 @@ public class ActiveAnimationRetargeterTests : TestBase
Assert.That(curveBindings, Does.Contain(EditorCurveBinding.FloatCurve( Assert.That(curveBindings, Does.Contain(EditorCurveBinding.FloatCurve(
pathMappings.GetObjectIdentifier(created), typeof(GameObject), "m_IsActive"))); pathMappings.GetObjectIdentifier(created), typeof(GameObject), "m_IsActive")));
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
@ -30,4 +32,6 @@ namespace modular_avatar_tests.AnimateAddedBones
Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding)); Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding));
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.ndmf; #if MA_VRCSDK3_AVATARS
using nadena.dev.ndmf;
using nadena.dev.modular_avatar.animation; using nadena.dev.modular_avatar.animation;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
@ -24,4 +26,6 @@ namespace modular_avatar_tests
Assert.False(new SerializedObject(hq_off.motion).FindProperty("m_UseHighQualityCurve").boolValue); Assert.False(new SerializedObject(hq_off.motion).FindProperty("m_UseHighQualityCurve").boolValue);
} }
} }
} }
#endif

View File

@ -4,7 +4,10 @@ using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
namespace modular_avatar_tests namespace modular_avatar_tests
{ {
@ -92,6 +95,7 @@ namespace modular_avatar_tests
Assert.AreEqual("a/b/c/d", toc.PathMappings.MapPath("a/b/c/d", true)); Assert.AreEqual("a/b/c/d", toc.PathMappings.MapPath("a/b/c/d", true));
} }
#if MA_VRCSDK3_AVATARS
[Test] [Test]
public void TestAnimatorControllerUpdates() public void TestAnimatorControllerUpdates()
{ {
@ -143,5 +147,6 @@ namespace modular_avatar_tests
} }
} }
} }
#endif
} }
} }

View File

@ -1,4 +1,6 @@
using System.Collections.Immutable; #if MA_VRCSDK3_AVATARS
using System.Collections.Immutable;
using System.Linq; using System.Linq;
using modular_avatar_tests; using modular_avatar_tests;
using nadena.dev.modular_avatar.animation; using nadena.dev.modular_avatar.animation;
@ -38,4 +40,6 @@ namespace modular_avatar_tests
Assert.AreEqual(bindings.Count, 7); Assert.AreEqual(bindings.Count, 7);
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor.Animations; using UnityEditor.Animations;
@ -23,4 +25,6 @@ namespace modular_avatar_tests.DirectBlendTreeParameters
Assert.AreEqual(children[1].directBlendParameter, "C"); //remapped Assert.AreEqual(children[1].directBlendParameter, "C"); //remapped
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using VRC.SDK3.Dynamics.PhysBone.Components; using VRC.SDK3.Dynamics.PhysBone.Components;
@ -65,4 +67,6 @@ namespace modular_avatar_tests.DuplicatePBStripping
Assert.AreEqual(2, prefab.GetComponentsInChildren<VRCPhysBone>().Length); Assert.AreEqual(2, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
} }
} }
} }
#endif

View File

@ -3,7 +3,11 @@ using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
using UnityObject = UnityEngine.Object; using UnityObject = UnityEngine.Object;
public class ArmatureConfusionTest : TestBase public class ArmatureConfusionTest : TestBase
@ -24,7 +28,9 @@ public class ArmatureConfusionTest : TestBase
var inner = CreatePrefab("shapell.fbx"); var inner = CreatePrefab("shapell.fbx");
var outerAnimator = outer.GetComponent<Animator>(); var outerAnimator = outer.GetComponent<Animator>();
#if MA_VRCSDK3_AVATARS
outer.AddComponent<VRCAvatarDescriptor>(); outer.AddComponent<VRCAvatarDescriptor>();
#endif
inner.gameObject.name = "inner"; inner.gameObject.name = "inner";
inner.transform.parent = outer.transform; inner.transform.parent = outer.transform;

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -35,4 +37,6 @@ namespace modular_avatar_tests
} }
} }
} }
} }
#endif

View File

@ -3,7 +3,6 @@ using modular_avatar_tests;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
public class GameObjectGC : TestBase public class GameObjectGC : TestBase
{ {
@ -11,9 +10,9 @@ public class GameObjectGC : TestBase
public void FakeHumanoidHandling() public void FakeHumanoidHandling()
{ {
var fake_humanoid = CreatePrefab("FakeHumanoid.prefab"); var fake_humanoid = CreatePrefab("FakeHumanoid.prefab");
var avdesc = fake_humanoid.GetComponent<VRCAvatarDescriptor>(); var context = new BuildContext(fake_humanoid);
new GCGameObjectsPass(new BuildContext(avdesc), fake_humanoid).OnPreprocessAvatar(); new GCGameObjectsPass(context, fake_humanoid).OnPreprocessAvatar();
AvatarProcessor.ProcessAvatar(fake_humanoid); AvatarProcessor.ProcessAvatar(fake_humanoid);
var animator = fake_humanoid.GetComponent<Animator>(); var animator = fake_humanoid.GetComponent<Animator>();
@ -26,13 +25,13 @@ public class GameObjectGC : TestBase
public void RetainEndBones() public void RetainEndBones()
{ {
var fake_humanoid = CreatePrefab("FakeHumanoid.prefab"); var fake_humanoid = CreatePrefab("FakeHumanoid.prefab");
var avdesc = fake_humanoid.GetComponent<VRCAvatarDescriptor>(); var context = new BuildContext(fake_humanoid);
var bone1 = CreateChild(fake_humanoid, "bone1"); var bone1 = CreateChild(fake_humanoid, "bone1");
var bone2 = CreateChild(bone1, "bone2.end"); var bone2 = CreateChild(bone1, "bone2.end");
var bone3 = CreateChild(fake_humanoid, "bone2"); var bone3 = CreateChild(fake_humanoid, "bone2");
new GCGameObjectsPass(new BuildContext(avdesc), fake_humanoid).OnPreprocessAvatar(); new GCGameObjectsPass(context, fake_humanoid).OnPreprocessAvatar();
AvatarProcessor.ProcessAvatar(fake_humanoid); AvatarProcessor.ProcessAvatar(fake_humanoid);
Assert.True(bone1 != null); Assert.True(bone1 != null);
@ -44,17 +43,17 @@ public class GameObjectGC : TestBase
public void RetainArmatureHack() public void RetainArmatureHack()
{ {
var fake_humanoid = CreatePrefab("FakeHumanoid.prefab"); var fake_humanoid = CreatePrefab("FakeHumanoid.prefab");
var avdesc = fake_humanoid.GetComponent<VRCAvatarDescriptor>(); var context = new BuildContext(fake_humanoid);
var armature = new GameObject(); var armature = new GameObject();
armature.name = "Armature"; armature.name = "Armature";
armature.transform.parent = fake_humanoid.transform; armature.transform.parent = fake_humanoid.transform;
armature.transform.SetSiblingIndex(0); armature.transform.SetSiblingIndex(0);
new GCGameObjectsPass(new BuildContext(avdesc), fake_humanoid).OnPreprocessAvatar(); new GCGameObjectsPass(context, fake_humanoid).OnPreprocessAvatar();
AvatarProcessor.ProcessAvatar(fake_humanoid); AvatarProcessor.ProcessAvatar(fake_humanoid);
Assert.AreEqual(2, Assert.AreEqual(2,
avdesc.GetComponentsInChildren<Transform>().Count(t => t.gameObject.name == "Armature")); context.AvatarRootObject.GetComponentsInChildren<Transform>().Count(t => t.gameObject.name == "Armature"));
} }
} }

View File

@ -4,7 +4,6 @@ using nadena.dev.modular_avatar.core;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests.MergeArmatureTests namespace modular_avatar_tests.MergeArmatureTests
{ {
@ -53,7 +52,7 @@ namespace modular_avatar_tests.MergeArmatureTests
m2_leaf3.AddComponent<TestComponentB>(); m2_leaf3.AddComponent<TestComponentB>();
nadena.dev.ndmf.BuildContext context = nadena.dev.ndmf.BuildContext context =
new nadena.dev.ndmf.BuildContext(root.GetComponent<VRCAvatarDescriptor>(), null); new nadena.dev.ndmf.BuildContext(root, null);
context.ActivateExtensionContext<ModularAvatarContext>(); context.ActivateExtensionContext<ModularAvatarContext>();
context.ActivateExtensionContext<AnimationServicesContext>(); context.ActivateExtensionContext<AnimationServicesContext>();
new MergeArmatureHook().OnPreprocessAvatar(context, root); new MergeArmatureHook().OnPreprocessAvatar(context, root);
@ -81,7 +80,7 @@ namespace modular_avatar_tests.MergeArmatureTests
ma.mangleNames = false; ma.mangleNames = false;
nadena.dev.ndmf.BuildContext context = nadena.dev.ndmf.BuildContext context =
new nadena.dev.ndmf.BuildContext(root.GetComponent<VRCAvatarDescriptor>(), null); new nadena.dev.ndmf.BuildContext(root, null);
context.ActivateExtensionContext<ModularAvatarContext>(); context.ActivateExtensionContext<ModularAvatarContext>();
context.ActivateExtensionContext<AnimationServicesContext>(); context.ActivateExtensionContext<AnimationServicesContext>();
new MergeArmatureHook().OnPreprocessAvatar(context, root); new MergeArmatureHook().OnPreprocessAvatar(context, root);
@ -105,7 +104,7 @@ namespace modular_avatar_tests.MergeArmatureTests
ma.mergeTarget.referencePath = RuntimeUtil.AvatarRootPath(armature); ma.mergeTarget.referencePath = RuntimeUtil.AvatarRootPath(armature);
nadena.dev.ndmf.BuildContext context = nadena.dev.ndmf.BuildContext context =
new nadena.dev.ndmf.BuildContext(root.GetComponent<VRCAvatarDescriptor>(), null); new nadena.dev.ndmf.BuildContext(root, null);
context.ActivateExtensionContext<ModularAvatarContext>(); context.ActivateExtensionContext<ModularAvatarContext>();
context.ActivateExtensionContext<AnimationServicesContext>(); context.ActivateExtensionContext<AnimationServicesContext>();
new MergeArmatureHook().OnPreprocessAvatar(context, root); new MergeArmatureHook().OnPreprocessAvatar(context, root);

View File

@ -1,7 +1,6 @@
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests namespace modular_avatar_tests
{ {
@ -13,7 +12,7 @@ namespace modular_avatar_tests
public void TestProbeAnchor() public void TestProbeAnchor()
{ {
var prefab = CreatePrefab(PREFAB_NAME); var prefab = CreatePrefab(PREFAB_NAME);
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>()); var context = new BuildContext(prefab);
new MeshSettingsPass(context).OnPreprocessAvatar(); new MeshSettingsPass(context).OnPreprocessAvatar();
var root = prefab.transform.Find("RendererRoot"); var root = prefab.transform.Find("RendererRoot");
@ -33,7 +32,7 @@ namespace modular_avatar_tests
public void TestProbeAnchorOverrides() public void TestProbeAnchorOverrides()
{ {
var prefab = CreatePrefab(PREFAB_NAME); var prefab = CreatePrefab(PREFAB_NAME);
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>()); var context = new BuildContext(prefab);
new MeshSettingsPass(context).OnPreprocessAvatar(); new MeshSettingsPass(context).OnPreprocessAvatar();
var noninherit = prefab.transform.Find("ProbeTargetRenderers/NonInherited").GetComponent<MeshRenderer>(); var noninherit = prefab.transform.Find("ProbeTargetRenderers/NonInherited").GetComponent<MeshRenderer>();
@ -47,7 +46,7 @@ namespace modular_avatar_tests
public void TestSetBounds() public void TestSetBounds()
{ {
var prefab = CreatePrefab(PREFAB_NAME); var prefab = CreatePrefab(PREFAB_NAME);
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>()); var context = new BuildContext(prefab);
new MeshSettingsPass(context).OnPreprocessAvatar(); new MeshSettingsPass(context).OnPreprocessAvatar();
var target = prefab.transform.Find("ProbeTarget"); var target = prefab.transform.Find("ProbeTarget");

View File

@ -1,4 +1,6 @@
using modular_avatar_tests; #if MA_VRCSDK3_AVATARS
using modular_avatar_tests;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
@ -19,4 +21,6 @@ public class MiscAnimationTests : TestBase
Assert.True(new SerializedObject(hq_on.motion).FindProperty("m_UseHighQualityCurve").boolValue); Assert.True(new SerializedObject(hq_on.motion).FindProperty("m_UseHighQualityCurve").boolValue);
Assert.False(new SerializedObject(hq_off.motion).FindProperty("m_UseHighQualityCurve").boolValue); Assert.False(new SerializedObject(hq_off.motion).FindProperty("m_UseHighQualityCurve").boolValue);
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -21,4 +23,6 @@ namespace modular_avatar_tests
ParameterPolicy.ProbeParameters(root); ParameterPolicy.ProbeParameters(root);
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -61,4 +63,6 @@ namespace modular_avatar_tests.RenameParametersTests
AvatarProcessor.ProcessAvatar(avatar); AvatarProcessor.ProcessAvatar(avatar);
} }
} }
} }
#endif

View File

@ -5,7 +5,6 @@ using nadena.dev.modular_avatar.core.editor;
using nadena.dev.modular_avatar.editor.ErrorReporting; using nadena.dev.modular_avatar.editor.ErrorReporting;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests.ReplaceObject namespace modular_avatar_tests.ReplaceObject
{ {
@ -15,8 +14,7 @@ namespace modular_avatar_tests.ReplaceObject
void Process(GameObject root) void Process(GameObject root)
{ {
var avDesc = root.GetComponent<VRCAvatarDescriptor>(); var buildContext = new nadena.dev.ndmf.BuildContext(root, null);
var buildContext = new nadena.dev.ndmf.BuildContext(avDesc, null);
pathMappings = buildContext.ActivateExtensionContext<AnimationServicesContext>().PathMappings; pathMappings = buildContext.ActivateExtensionContext<AnimationServicesContext>().PathMappings;
new ReplaceObjectPass(buildContext).Process(); new ReplaceObjectPass(buildContext).Process();
} }

View File

@ -2,7 +2,6 @@
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests namespace modular_avatar_tests
{ {
@ -21,8 +20,7 @@ namespace modular_avatar_tests
skinnedMeshRenderer.rootBone = b.transform; skinnedMeshRenderer.rootBone = b.transform;
Debug.Assert(skinnedMeshRenderer.bones.Length == 0); Debug.Assert(skinnedMeshRenderer.bones.Length == 0);
var build_context = var build_context = new nadena.dev.ndmf.BuildContext(root, null);
new nadena.dev.ndmf.BuildContext(root.GetComponent<VRCAvatarDescriptor>(), null);
var torc = new AnimationServicesContext(); var torc = new AnimationServicesContext();
torc.OnActivate(build_context); torc.OnActivate(build_context);
@ -48,8 +46,7 @@ namespace modular_avatar_tests
skinnedMeshRenderer.rootBone = b.transform; skinnedMeshRenderer.rootBone = b.transform;
Debug.Assert(skinnedMeshRenderer.bones.Length == 0); Debug.Assert(skinnedMeshRenderer.bones.Length == 0);
var build_context = var build_context = new nadena.dev.ndmf.BuildContext(root, null);
new nadena.dev.ndmf.BuildContext(root.GetComponent<VRCAvatarDescriptor>(), null);
var torc = new AnimationServicesContext(); var torc = new AnimationServicesContext();
torc.OnActivate(build_context); torc.OnActivate(build_context);

View File

@ -1,4 +1,6 @@
using System.Linq; #if MA_VRCSDK3_AVATARS
using System.Linq;
using modular_avatar_tests; using modular_avatar_tests;
using nadena.dev.ndmf.runtime; using nadena.dev.ndmf.runtime;
using nadena.dev.modular_avatar.core; using nadena.dev.modular_avatar.core;
@ -64,4 +66,6 @@ namespace _ModularAvatar.EditModeTests.SerializationTests
Assert.IsInstanceOf<GeneratedAssets>(mainAsset); Assert.IsInstanceOf<GeneratedAssets>(mainAsset);
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
@ -29,4 +31,6 @@ namespace modular_avatar_tests.SimpleArmatureToggle
Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding2)); Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding2));
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
@ -94,4 +96,6 @@ namespace modular_avatar_tests.SyncedLayerHandling
Assert.AreEqual(2, layercontrol.layer); Assert.AreEqual(2, layercontrol.layer);
} }
} }
} }
#endif

View File

@ -7,7 +7,10 @@ using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
#if MA_VRCSDK3_AVATARS
using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.Components;
#endif
namespace modular_avatar_tests namespace modular_avatar_tests
{ {
@ -95,6 +98,7 @@ namespace modular_avatar_tests
return obj; return obj;
} }
#if MA_VRCSDK3_AVATARS
protected static AnimationClip findFxClip(GameObject prefab, string layerName) protected static AnimationClip findFxClip(GameObject prefab, string layerName)
{ {
var motion = findFxMotion(prefab, layerName) as AnimationClip; var motion = findFxMotion(prefab, layerName) as AnimationClip;
@ -110,6 +114,7 @@ namespace modular_avatar_tests
return state.motion; return state.motion;
} }
#endif
protected static AnimatorState FindStateInLayer(AnimatorControllerLayer layer, string stateName) protected static AnimatorState FindStateInLayer(AnimatorControllerLayer layer, string stateName)
{ {
@ -121,6 +126,7 @@ namespace modular_avatar_tests
return null; return null;
} }
#if MA_VRCSDK3_AVATARS
protected static AnimatorControllerLayer findFxLayer(GameObject prefab, string layerName) protected static AnimatorControllerLayer findFxLayer(GameObject prefab, string layerName)
{ {
var fx = prefab.GetComponent<VRCAvatarDescriptor>().baseAnimationLayers var fx = prefab.GetComponent<VRCAvatarDescriptor>().baseAnimationLayers
@ -135,5 +141,6 @@ namespace modular_avatar_tests
Assert.NotNull(layer); Assert.NotNull(layer);
return layer; return layer;
} }
#endif
} }
} }

View File

@ -25,6 +25,12 @@
"defineConstraints": [ "defineConstraints": [
"UNITY_INCLUDE_TESTS" "UNITY_INCLUDE_TESTS"
], ],
"versionDefines": [], "versionDefines": [
{
"name": "com.vrchat.avatars",
"expression": "",
"define": "MA_VRCSDK3_AVATARS"
}
],
"noEngineReferences": false "noEngineReferences": false
} }

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
@ -24,4 +26,6 @@ namespace modular_avatar_tests.TransformMappingThroughSwitchedObject
Assert.IsNotNull(curve); Assert.IsNotNull(curve);
} }
} }
} }
#endif

View File

@ -1,4 +1,6 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using nadena.dev.modular_avatar.core; using nadena.dev.modular_avatar.core;
@ -767,4 +769,6 @@ namespace modular_avatar_tests.VirtualMenuTests
return null; return null;
} }
} }
} }
#endif

View File

@ -3,7 +3,6 @@ using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine.Animations; using UnityEngine.Animations;
using VRC.SDK3.Avatars.Components;
public class WorldFixedObjectTest : TestBase public class WorldFixedObjectTest : TestBase
{ {
@ -11,12 +10,11 @@ public class WorldFixedObjectTest : TestBase
public void SimpleTest() public void SimpleTest()
{ {
var avatar = CreatePrefab("Simple.prefab"); var avatar = CreatePrefab("Simple.prefab");
var descriptor = avatar.GetComponent<VRCAvatarDescriptor>();
var fixedObject = avatar.transform.Find("FixedObject"); var fixedObject = avatar.transform.Find("FixedObject");
// initialize context // initialize context
var buildContext = new BuildContext(descriptor); var buildContext = new BuildContext(avatar);
buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>(); buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>();
new WorldFixedObjectProcessor().Process(buildContext); new WorldFixedObjectProcessor().Process(buildContext);
@ -37,13 +35,12 @@ public class WorldFixedObjectTest : TestBase
public void NestedTest() public void NestedTest()
{ {
var avatar = CreatePrefab("Nested.prefab"); var avatar = CreatePrefab("Nested.prefab");
var descriptor = avatar.GetComponent<VRCAvatarDescriptor>();
var fixedObject = avatar.transform.Find("FixedObject"); var fixedObject = avatar.transform.Find("FixedObject");
var nestedFixed = avatar.transform.Find("FixedObject/NestedFixed"); var nestedFixed = avatar.transform.Find("FixedObject/NestedFixed");
// initialize context // initialize context
var buildContext = new BuildContext(descriptor); var buildContext = new BuildContext(avatar);
buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>(); buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>();
new WorldFixedObjectProcessor().Process(buildContext); new WorldFixedObjectProcessor().Process(buildContext);