mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-04 19:49:02 +08:00
refactor: use VirtualControllerContext.Controllers
This commit is contained in:
parent
72a9b0718c
commit
26ea852d42
@ -23,7 +23,7 @@ namespace nadena.dev.modular_avatar.animation
|
||||
var activeProxies = context.GetState<ReadablePropertyExtension.Retained>().proxyProps;
|
||||
if (activeProxies.Count == 0) return;
|
||||
|
||||
var fx = asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
var fx = asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
if (fx == null) return;
|
||||
|
||||
var nullMotion = new AnimationClip();
|
||||
|
@ -94,7 +94,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
var afterOriginal = sorted.Where(x => x.layerPriority >= 0)
|
||||
.ToList();
|
||||
|
||||
var controller = _asc.ControllerContext[layerType];
|
||||
var controller = _asc.ControllerContext.Controllers[layerType];
|
||||
|
||||
var wdStateCounter = controller.Layers.SelectMany(l => l.StateMachine.AllStates())
|
||||
.Select(s => s.WriteDefaultValues)
|
||||
|
@ -43,8 +43,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
_asc = context.Extension<AnimatorServicesContext>();
|
||||
_rootBlendTree = null;
|
||||
_parameterNames = new HashSet<string>();
|
||||
|
||||
var fx = _asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
|
||||
var fx = _asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
|
||||
foreach (var component in
|
||||
context.AvatarRootObject.GetComponentsInChildren<ModularAvatarMergeBlendTree>(true))
|
||||
@ -132,8 +132,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
private VirtualBlendTree GetRootBlendTree()
|
||||
{
|
||||
if (_rootBlendTree != null) return _rootBlendTree;
|
||||
|
||||
var fx = _asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
|
||||
var fx = _asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
var controller = fx.AddLayer(new LayerPriority(int.MinValue), BlendTreeLayerName);
|
||||
var stateMachine = controller.StateMachine;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
// Having a WD OFF layer after WD ON layers can break WD. We match the behavior of the existing states,
|
||||
// and if mixed, use WD ON to maximize compatibility.
|
||||
var asc = context.Extension<AnimatorServicesContext>();
|
||||
_writeDefaults = asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX]?.Layers.Any(
|
||||
_writeDefaults = asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX]?.Layers.Any(
|
||||
l => l.StateMachine.StateMachines.Any(
|
||||
sm => sm.StateMachine.AllStates().Any(
|
||||
s => s.WriteDefaultValues && s.Motion is not VirtualBlendTree
|
||||
@ -593,9 +593,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
private void ApplyController(AnimatorStateMachine asm, string layerName)
|
||||
{
|
||||
var asc = context.Extension<AnimatorServicesContext>();
|
||||
var fx = asc.ControllerContext[
|
||||
VRCAvatarDescriptor.AnimLayerType.FX
|
||||
];
|
||||
var fx = asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
|
||||
if (fx == null)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using nadena.dev.ndmf;
|
||||
using nadena.dev.ndmf.animator;
|
||||
using UnityEditor.Animations;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Avatars.Components;
|
||||
using VRC.SDK3.Avatars.ScriptableObjects;
|
||||
@ -203,7 +202,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
if (mamiWithRC.Count > 0)
|
||||
{
|
||||
var asc = context.Extension<AnimatorServicesContext>();
|
||||
var fx = asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
var fx = asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX];
|
||||
|
||||
foreach (var (name, _) in mamiWithRC)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
);
|
||||
}).ToImmutableDictionary();
|
||||
|
||||
var controller = animServices.ControllerContext[virtualized];
|
||||
var controller = animServices.ControllerContext.Controllers[virtualized];
|
||||
if (controller != null)
|
||||
{
|
||||
ProcessVirtualAnimatorController(controller, remap);
|
||||
|
@ -31,7 +31,7 @@ public class ActiveAnimationRetargeterTests : TestBase
|
||||
var created = retargeter.CreateIntermediateObjects(newParent.gameObject);
|
||||
retargeter.FixupAnimations();
|
||||
|
||||
var fx = asc.ControllerContext[VRCAvatarDescriptor.AnimLayerType.FX]!;
|
||||
var fx = asc.ControllerContext.Controllers[VRCAvatarDescriptor.AnimLayerType.FX]!;
|
||||
var clip = (VirtualClip) fx.Layers.First(l => l.Name == "retarget").StateMachine.DefaultState!.Motion;
|
||||
var curveBindings = clip!.GetFloatCurveBindings();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user