Disable compilation for use in Unity 6 (6000.0.20f1):

- Do not compile some classes and code paths in non-VRChat projects.
- This has been tested in Unity 6 (6000.0.20f1).
This commit is contained in:
Haï~ 2024-10-01 09:39:28 +02:00
parent a71af7ae0a
commit eecb9c2c21
20 changed files with 82 additions and 30 deletions

View File

@ -7,7 +7,9 @@ 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
@ -89,12 +91,14 @@ namespace nadena.dev.modular_avatar.animation
// HACK: This is a temporary crutch until we rework the entire animator services system // HACK: This is a temporary crutch until we rework the entire animator services system
public void AddPropertyDefinition(AnimatorControllerParameter paramDef) public void AddPropertyDefinition(AnimatorControllerParameter paramDef)
{ {
#if MA_VRCSDK3_AVATARS
var fx = (AnimatorController) var fx = (AnimatorController)
_context.AvatarDescriptor.baseAnimationLayers _context.AvatarDescriptor.baseAnimationLayers
.First(l => l.type == VRCAvatarDescriptor.AnimLayerType.FX) .First(l => l.type == VRCAvatarDescriptor.AnimLayerType.FX)
.animatorController; .animatorController;
fx.parameters = fx.parameters.Concat(new[] { paramDef }).ToArray(); fx.parameters = fx.parameters.Concat(new[] { paramDef }).ToArray();
#endif
} }
public string GetActiveSelfProxy(GameObject obj) public string GetActiveSelfProxy(GameObject obj)

View File

@ -1,4 +1,5 @@
using System.Linq; #if MA_VRCSDK3_AVATARS
using System.Linq;
using nadena.dev.ndmf; using nadena.dev.ndmf;
using UnityEditor; using UnityEditor;
using UnityEditor.Animations; using UnityEditor.Animations;
@ -72,4 +73,5 @@ namespace nadena.dev.modular_avatar.animation
}; };
} }
} }
} }
#endif

View File

@ -368,6 +368,7 @@ namespace nadena.dev.modular_avatar.animation
} }
Profiler.EndSample(); Profiler.EndSample();
#if MA_VRCSDK3_AVATARS
var layers = context.AvatarDescriptor.baseAnimationLayers var layers = context.AvatarDescriptor.baseAnimationLayers
.Concat(context.AvatarDescriptor.specialAnimationLayers); .Concat(context.AvatarDescriptor.specialAnimationLayers);
@ -383,6 +384,7 @@ namespace nadena.dev.modular_avatar.animation
ApplyMappingsToAvatarMask(acLayer.avatarMask); ApplyMappingsToAvatarMask(acLayer.avatarMask);
} }
Profiler.EndSample(); Profiler.EndSample();
#endif
Profiler.EndSample(); Profiler.EndSample();
} }

View File

@ -1,4 +1,5 @@
#region #if MA_VRCSDK3_AVATARS
#region
using System; using System;
using System.Collections.Immutable; using System.Collections.Immutable;
@ -57,4 +58,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using UnityEditor; #if MA_VRCSDK3_AVATARS
using UnityEditor;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
@ -45,3 +46,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using nadena.dev.modular_avatar.ui; #if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.ui;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Avatars.ScriptableObjects;
@ -62,4 +63,5 @@ namespace nadena.dev.modular_avatar.core.editor
Undo.RegisterCreatedObjectUndo(toggle, "Create Toggle"); Undo.RegisterCreatedObjectUndo(toggle, "Create Toggle");
} }
} }
} }
#endif

View File

@ -57,19 +57,23 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
#endif #endif
seq.WithRequiredExtension(typeof(AnimationServicesContext), _s2 => seq.WithRequiredExtension(typeof(AnimationServicesContext), _s2 =>
{ {
#if MA_VRCSDK3_AVATARS
seq.Run("Shape Changer", ctx => new ReactiveObjectPass(ctx).Execute()) seq.Run("Shape Changer", ctx => new ReactiveObjectPass(ctx).Execute())
.PreviewingWith(new ShapeChangerPreview(), new ObjectSwitcherPreview(), new MaterialSetterPreview()); .PreviewingWith(new ShapeChangerPreview(), new ObjectSwitcherPreview(), new MaterialSetterPreview());
#endif
seq.Run(MergeArmaturePluginPass.Instance); seq.Run(MergeArmaturePluginPass.Instance);
seq.Run(BoneProxyPluginPass.Instance); seq.Run(BoneProxyPluginPass.Instance);
#if MA_VRCSDK3_AVATARS
seq.Run(VisibleHeadAccessoryPluginPass.Instance); seq.Run(VisibleHeadAccessoryPluginPass.Instance);
#endif
seq.Run("World Fixed Object", seq.Run("World Fixed Object",
ctx => new WorldFixedObjectProcessor().Process(ctx) ctx => new WorldFixedObjectProcessor().Process(ctx)
); );
seq.Run(ReplaceObjectPluginPass.Instance); seq.Run(ReplaceObjectPluginPass.Instance);
#if MA_VRCSDK3_AVATARS #if MA_VRCSDK3_AVATARS
seq.Run(BlendshapeSyncAnimationPluginPass.Instance); seq.Run(BlendshapeSyncAnimationPluginPass.Instance);
#endif
seq.Run(GameObjectDelayDisablePass.Instance); seq.Run(GameObjectDelayDisablePass.Instance);
#endif
seq.Run(ConstraintConverterPass.Instance); seq.Run(ConstraintConverterPass.Instance);
}); });
#if MA_VRCSDK3_AVATARS #if MA_VRCSDK3_AVATARS
@ -207,6 +211,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
} }
} }
#if MA_VRCSDK3_AVATARS
class VisibleHeadAccessoryPluginPass : MAPass<VisibleHeadAccessoryPluginPass> class VisibleHeadAccessoryPluginPass : MAPass<VisibleHeadAccessoryPluginPass>
{ {
protected override void Execute(ndmf.BuildContext context) protected override void Execute(ndmf.BuildContext context)
@ -214,6 +219,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
new VisibleHeadAccessoryProcessor(MAContext(context)).Process(); new VisibleHeadAccessoryProcessor(MAContext(context)).Process();
} }
} }
#endif
class ReplaceObjectPluginPass : MAPass<ReplaceObjectPluginPass> class ReplaceObjectPluginPass : MAPass<ReplaceObjectPluginPass>
{ {

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; #if MA_VRCSDK3_AVATARS
using System.Collections.Generic;
using System.Linq; using System.Linq;
using nadena.dev.ndmf.preview; using nadena.dev.ndmf.preview;
using UnityEngine; using UnityEngine;
@ -244,4 +245,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
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 nadena.dev.modular_avatar.animation; using nadena.dev.modular_avatar.animation;
@ -313,4 +314,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
#region #if MA_VRCSDK3_AVATARS
#region
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -582,3 +583,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using nadena.dev.ndmf; #if MA_VRCSDK3_AVATARS
using nadena.dev.ndmf;
using UnityEditor.Animations; using UnityEditor.Animations;
using UnityEngine; using UnityEngine;
@ -53,4 +54,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
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 System.Threading.Tasks; using System.Threading.Tasks;
@ -144,4 +145,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using System; #if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic; using System.Collections.Generic;
using nadena.dev.ndmf; using nadena.dev.ndmf;
using nadena.dev.ndmf.preview; using nadena.dev.ndmf.preview;
@ -70,4 +71,5 @@ namespace nadena.dev.modular_avatar.core.editor
return _context.Observe(mami, _ => mami.isDefault); return _context.Observe(mami, _ => mami.isDefault);
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
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 System.Threading.Tasks; using System.Threading.Tasks;
@ -104,4 +105,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; #if MA_VRCSDK3_AVATARS
using System.Collections.Generic;
using System.Linq; using System.Linq;
using nadena.dev.ndmf; using nadena.dev.ndmf;
using UnityEngine; using UnityEngine;
@ -236,4 +237,5 @@ namespace nadena.dev.modular_avatar.core.editor
}; };
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
#region #if MA_VRCSDK3_AVATARS
#region
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -265,4 +266,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
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;
@ -635,4 +636,5 @@ namespace nadena.dev.modular_avatar.core.editor.Simulator
ve_inactive.style.display = activeState ? DisplayStyle.None : DisplayStyle.Flex; ve_inactive.style.display = activeState ? DisplayStyle.None : DisplayStyle.Flex;
} }
} }
} }
#endif

View File

@ -1,5 +1,7 @@
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
#if MA_VRCSDK3_AVATARS
using nadena.dev.modular_avatar.core.editor.Simulator; using nadena.dev.modular_avatar.core.editor.Simulator;
#endif
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.UIElements; using UnityEngine.UIElements;
@ -42,11 +44,13 @@ namespace nadena.dev.modular_avatar.core.editor
private void OpenDebugger() private void OpenDebugger()
{ {
#if MA_VRCSDK3_AVATARS
GameObject target = Selection.activeGameObject; GameObject target = Selection.activeGameObject;
if (ReferenceObject is Component c) target = c.gameObject; if (ReferenceObject is Component c) target = c.gameObject;
else if (ReferenceObject is GameObject go) target = go; else if (ReferenceObject is GameObject go) target = go;
ROSimulator.OpenDebugger(target); ROSimulator.OpenDebugger(target);
#endif
} }
} }
} }

View File

@ -1,4 +1,6 @@
using nadena.dev.modular_avatar.core.editor.Simulator; #if MA_VRCSDK3_AVATARS
using System;
using nadena.dev.modular_avatar.core.editor.Simulator;
using UnityEditor; using UnityEditor;
using UnityEngine.UIElements; using UnityEngine.UIElements;
@ -74,4 +76,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
#region #if MA_VRCSDK3_AVATARS
#region
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -251,3 +252,5 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
} }
#endif