(MIGRATION) Fix all compilation issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using System;
|
using System;
|
||||||
using AnimatorAsCode.V0;
|
using AnimatorAsCode.V1;
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
@@ -90,7 +91,6 @@ namespace AnimatorAsCodeFramework.Examples
|
|||||||
{
|
{
|
||||||
SystemName = systemName,
|
SystemName = systemName,
|
||||||
// In the examples, we consider the avatar to be also the animator root.
|
// In the examples, we consider the avatar to be also the animator root.
|
||||||
AvatarDescriptor = avatar,
|
|
||||||
// You can set the animator root to be different than the avatar descriptor,
|
// You can set the animator root to be different than the avatar descriptor,
|
||||||
// if you want to apply an animator to a different avatar without redefining
|
// if you want to apply an animator to a different avatar without redefining
|
||||||
// all of the game object references which were relative to the original avatar.
|
// all of the game object references which were relative to the original avatar.
|
||||||
@@ -105,7 +105,7 @@ namespace AnimatorAsCodeFramework.Examples
|
|||||||
AssetContainer = assetContainer,
|
AssetContainer = assetContainer,
|
||||||
AssetKey = assetKey,
|
AssetKey = assetKey,
|
||||||
DefaultsProvider = new AacDefaultsProvider(writeDefaults: options.WriteDefaults)
|
DefaultsProvider = new AacDefaultsProvider(writeDefaults: options.WriteDefaults)
|
||||||
});
|
}.WithAvatarDescriptor(avatar));
|
||||||
aac.ClearPreviousAssets();
|
aac.ClearPreviousAssets();
|
||||||
return aac;
|
return aac;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AnimatorAsCode.V0;
|
using AnimatorAsCode.V1;
|
||||||
using AnimatorAsCode.V0.Extensions.VRChat;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
|
using AnimatorAsCode.V1VRC;
|
||||||
|
|
||||||
namespace AnimatorAsCodeFramework.Examples
|
namespace AnimatorAsCodeFramework.Examples
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
+32
-63
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Avatars.Components;
|
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
@@ -16,16 +16,11 @@ namespace AnimatorAsCode.V1
|
|||||||
return new AacFlBase(configuration);
|
return new AacFlBase(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static AnimatorController AnimatorOf(VRCAvatarDescriptor ad, VRCAvatarDescriptor.AnimLayerType animLayerType)
|
|
||||||
{
|
|
||||||
return (AnimatorController) ad.baseAnimationLayers.First(it => it.type == animLayerType).animatorController;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static AnimationClip NewClip(AacConfiguration component, string suffix)
|
internal static AnimationClip NewClip(AacConfiguration component, string suffix)
|
||||||
{
|
{
|
||||||
return RegisterClip(component, suffix, new AnimationClip());
|
return RegisterClip(component, suffix, new AnimationClip());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static AnimationClip RegisterClip(AacConfiguration component, string suffix, AnimationClip clip)
|
internal static AnimationClip RegisterClip(AacConfiguration component, string suffix, AnimationClip clip)
|
||||||
{
|
{
|
||||||
clip.name = "zAutogenerated__" + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
clip.name = "zAutogenerated__" + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||||
@@ -82,12 +77,32 @@ namespace AnimatorAsCode.V1
|
|||||||
public struct AacConfiguration
|
public struct AacConfiguration
|
||||||
{
|
{
|
||||||
public string SystemName;
|
public string SystemName;
|
||||||
public VRCAvatarDescriptor AvatarDescriptor;
|
|
||||||
public Transform AnimatorRoot;
|
public Transform AnimatorRoot;
|
||||||
public Transform DefaultValueRoot;
|
public Transform DefaultValueRoot;
|
||||||
public AnimatorController AssetContainer;
|
public AnimatorController AssetContainer;
|
||||||
public string AssetKey;
|
public string AssetKey;
|
||||||
public IAacDefaultsProvider DefaultsProvider;
|
public IAacDefaultsProvider DefaultsProvider;
|
||||||
|
public Dictionary<Type, object> AdditionalData; // Nullable
|
||||||
|
|
||||||
|
public AacConfiguration WithAdditonalData(Type key, object value)
|
||||||
|
{
|
||||||
|
var conf = this;
|
||||||
|
if (AdditionalData == null) conf.AdditionalData = new Dictionary<Type, object>();
|
||||||
|
conf.AdditionalData[key] = value;
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryGetAdditionalData(Type key, out object value)
|
||||||
|
{
|
||||||
|
if (AdditionalData != null && AdditionalData.TryGetValue(key, out var result))
|
||||||
|
{
|
||||||
|
value = result;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct AacFlLayer
|
public struct AacFlLayer
|
||||||
@@ -276,6 +291,11 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
private readonly AacConfiguration _configuration;
|
private readonly AacConfiguration _configuration;
|
||||||
|
|
||||||
|
public AacConfiguration InternalConfiguration()
|
||||||
|
{
|
||||||
|
return _configuration;
|
||||||
|
}
|
||||||
|
|
||||||
internal AacFlBase(AacConfiguration configuration)
|
internal AacFlBase(AacConfiguration configuration)
|
||||||
{
|
{
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@@ -333,62 +353,11 @@ namespace AnimatorAsCode.V1
|
|||||||
.WithUnit(unit, keyframes => keyframes.Constant(0, 0f).Constant(duration, 0f)));
|
.WithUnit(unit, keyframes => keyframes.Constant(0, 0f).Constant(duration, 0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAllMainLayers()
|
public AacFlLayer CreateMainArbitraryControllerLayer(AnimatorController controller) => InternalDoCreateLayer(controller, _configuration.DefaultsProvider.ConvertLayerName(_configuration.SystemName));
|
||||||
{
|
public AacFlLayer CreateSupportingArbitraryControllerLayer(AnimatorController controller, string suffix) => InternalDoCreateLayer(controller, _configuration.DefaultsProvider.ConvertLayerNameWithSuffix(_configuration.SystemName, suffix));
|
||||||
var layerName = _configuration.SystemName;
|
public AacFlLayer CreateFirstArbitraryControllerLayer(AnimatorController controller) => InternalDoCreateLayer(controller, controller.layers[0].name);
|
||||||
RemoveLayerOnAllControllers(_configuration.DefaultsProvider.ConvertLayerName(layerName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveAllSupportingLayers(string suffix)
|
public AacFlLayer InternalDoCreateLayer(AnimatorController animator, string layerName)
|
||||||
{
|
|
||||||
var layerName = _configuration.SystemName;
|
|
||||||
RemoveLayerOnAllControllers(_configuration.DefaultsProvider.ConvertLayerNameWithSuffix(layerName, suffix));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveLayerOnAllControllers(string layerName)
|
|
||||||
{
|
|
||||||
var layers = _configuration.AvatarDescriptor.baseAnimationLayers.Select(layer => layer.animatorController).Where(layer => layer != null).Distinct().ToList();
|
|
||||||
foreach (var customAnimLayer in layers)
|
|
||||||
{
|
|
||||||
new AacAnimatorRemoval((AnimatorController) customAnimLayer).RemoveLayer(_configuration.DefaultsProvider.ConvertLayerName(layerName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AacFlLayer CreateMainFxLayer() => DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType.FX);
|
|
||||||
public AacFlLayer CreateMainGestureLayer() => DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType.Gesture);
|
|
||||||
public AacFlLayer CreateMainActionLayer() => DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType.Action);
|
|
||||||
public AacFlLayer CreateMainIdleLayer() => DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType.Additive);
|
|
||||||
public AacFlLayer CreateMainLocomotionLayer() => DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType.Base);
|
|
||||||
public AacFlLayer CreateMainAv3Layer(VRCAvatarDescriptor.AnimLayerType animLayerType) => DoCreateMainLayerOnController(animLayerType);
|
|
||||||
|
|
||||||
public AacFlLayer CreateSupportingFxLayer(string suffix) => DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType.FX, suffix);
|
|
||||||
public AacFlLayer CreateSupportingGestureLayer(string suffix) => DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType.Gesture, suffix);
|
|
||||||
public AacFlLayer CreateSupportingActionLayer(string suffix) => DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType.Action, suffix);
|
|
||||||
public AacFlLayer CreateSupportingIdleLayer(string suffix) => DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType.Additive, suffix);
|
|
||||||
public AacFlLayer CreateSupportingLocomotionLayer(string suffix) => DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType.Base, suffix);
|
|
||||||
public AacFlLayer CreateSupportingAv3Layer(VRCAvatarDescriptor.AnimLayerType animLayerType, string suffix) => DoCreateSupportingLayerOnController(animLayerType, suffix);
|
|
||||||
|
|
||||||
public AacFlLayer CreateMainArbitraryControllerLayer(AnimatorController controller) => DoCreateLayer(controller, _configuration.DefaultsProvider.ConvertLayerName(_configuration.SystemName));
|
|
||||||
public AacFlLayer CreateSupportingArbitraryControllerLayer(AnimatorController controller, string suffix) => DoCreateLayer(controller, _configuration.DefaultsProvider.ConvertLayerNameWithSuffix(_configuration.SystemName, suffix));
|
|
||||||
public AacFlLayer CreateFirstArbitraryControllerLayer(AnimatorController controller) => DoCreateLayer(controller, controller.layers[0].name);
|
|
||||||
|
|
||||||
private AacFlLayer DoCreateMainLayerOnController(VRCAvatarDescriptor.AnimLayerType animType)
|
|
||||||
{
|
|
||||||
var animator = AacV0.AnimatorOf(_configuration.AvatarDescriptor, animType);
|
|
||||||
var layerName = _configuration.DefaultsProvider.ConvertLayerName(_configuration.SystemName);
|
|
||||||
|
|
||||||
return DoCreateLayer(animator, layerName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AacFlLayer DoCreateSupportingLayerOnController(VRCAvatarDescriptor.AnimLayerType animType, string suffix)
|
|
||||||
{
|
|
||||||
var animator = AacV0.AnimatorOf(_configuration.AvatarDescriptor, animType);
|
|
||||||
var layerName = _configuration.DefaultsProvider.ConvertLayerNameWithSuffix(_configuration.SystemName, suffix);
|
|
||||||
|
|
||||||
return DoCreateLayer(animator, layerName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AacFlLayer DoCreateLayer(AnimatorController animator, string layerName)
|
|
||||||
{
|
{
|
||||||
var ag = new AacAnimatorGenerator(animator, CreateEmptyClip().Clip, _configuration.DefaultsProvider);
|
var ag = new AacAnimatorGenerator(animator, CreateEmptyClip().Clip, _configuration.DefaultsProvider);
|
||||||
var machine = ag.CreateOrClearLayerAtSameIndex(layerName, 1f);
|
var machine = ag.CreateOrClearLayerAtSameIndex(layerName, 1f);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal abstract float ValueToFloat(TParam value);
|
public abstract float ValueToFloat(TParam value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class AacFlNumericParameter<TParam> : AacFlParameter<TParam>
|
public abstract class AacFlNumericParameter<TParam> : AacFlParameter<TParam>
|
||||||
@@ -71,8 +71,8 @@ namespace AnimatorAsCode.V1
|
|||||||
protected AacFlFloatParameter(string name) : base(name) { }
|
protected AacFlFloatParameter(string name) : base(name) { }
|
||||||
public IAacFlCondition IsGreaterThan(float other) => Just(condition => condition.Add(Name, Greater, other));
|
public IAacFlCondition IsGreaterThan(float other) => Just(condition => condition.Add(Name, Greater, other));
|
||||||
public IAacFlCondition IsLessThan(float other) => Just(condition => condition.Add(Name, Less, other));
|
public IAacFlCondition IsLessThan(float other) => Just(condition => condition.Add(Name, Less, other));
|
||||||
|
|
||||||
protected internal override float ValueToFloat(float value)
|
public override float ValueToFloat(float value)
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,8 @@ namespace AnimatorAsCode.V1
|
|||||||
public IAacFlCondition IsLessThan(int other) => Just(condition => condition.Add(Name, Less, other));
|
public IAacFlCondition IsLessThan(int other) => Just(condition => condition.Add(Name, Less, other));
|
||||||
public IAacFlCondition IsEqualTo(int other) => Just(condition => condition.Add(Name, AnimatorConditionMode.Equals, other));
|
public IAacFlCondition IsEqualTo(int other) => Just(condition => condition.Add(Name, AnimatorConditionMode.Equals, other));
|
||||||
public IAacFlCondition IsNotEqualTo(int other) => Just(condition => condition.Add(Name, NotEqual, other));
|
public IAacFlCondition IsNotEqualTo(int other) => Just(condition => condition.Add(Name, NotEqual, other));
|
||||||
|
|
||||||
protected internal override float ValueToFloat(int value)
|
public override float ValueToFloat(int value)
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -112,8 +112,8 @@ namespace AnimatorAsCode.V1
|
|||||||
public IAacFlCondition IsFalse() => Just(condition => condition.Add(Name, IfNot, 0));
|
public IAacFlCondition IsFalse() => Just(condition => condition.Add(Name, IfNot, 0));
|
||||||
public IAacFlCondition IsEqualTo(bool other) => Just(condition => condition.Add(Name, other ? If : IfNot, 0));
|
public IAacFlCondition IsEqualTo(bool other) => Just(condition => condition.Add(Name, other ? If : IfNot, 0));
|
||||||
public IAacFlCondition IsNotEqualTo(bool other) => Just(condition => condition.Add(Name, other ? IfNot : If, 0));
|
public IAacFlCondition IsNotEqualTo(bool other) => Just(condition => condition.Add(Name, other ? IfNot : If, 0));
|
||||||
|
|
||||||
protected internal override float ValueToFloat(bool value)
|
public override float ValueToFloat(bool value)
|
||||||
{
|
{
|
||||||
return value ? 1f : 0f;
|
return value ? 1f : 0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace AnimatorAsCode.V1.Extensions.VRChat
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace AnimatorAsCode.V1VRC
|
||||||
{
|
{
|
||||||
public enum TrackingElement
|
public enum TrackingElement
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using AnimatorAsCode.V1;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using VRC.SDKBase;
|
using VRC.SDKBase;
|
||||||
|
|
||||||
namespace AnimatorAsCode.V1.Extensions.VRChat
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace AnimatorAsCode.V1VRC
|
||||||
{
|
{
|
||||||
public static class VRChatExtensions
|
public static class VRChatExtensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 009c7850b6354567b617f718f1f0ed27
|
||||||
|
timeCreated: 1693747359
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEditor.Animations;
|
||||||
|
using VRC.SDK3.Avatars.Components;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace AnimatorAsCode.V1.VRCDestructiveWorkflow
|
||||||
|
{
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public static class AacV1VRCDestructiveWorkflowExtensions
|
||||||
|
{
|
||||||
|
private interface IAdditionalDataAvatarDescriptor {}
|
||||||
|
|
||||||
|
public static AacConfiguration WithAvatarDescriptor(this AacConfiguration that, VRCAvatarDescriptor avatarDescriptor)
|
||||||
|
{
|
||||||
|
return that.WithAdditonalData(typeof(IAdditionalDataAvatarDescriptor), avatarDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AacFlLayer CreateMainFxLayer(this AacFlBase that) => DoCreateMainLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.FX);
|
||||||
|
public static AacFlLayer CreateMainGestureLayer(this AacFlBase that) => DoCreateMainLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Gesture);
|
||||||
|
public static AacFlLayer CreateMainActionLayer(this AacFlBase that) => DoCreateMainLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Action);
|
||||||
|
public static AacFlLayer CreateMainIdleLayer(this AacFlBase that) => DoCreateMainLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Additive);
|
||||||
|
public static AacFlLayer CreateMainLocomotionLayer(this AacFlBase that) => DoCreateMainLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Base);
|
||||||
|
public static AacFlLayer CreateMainAv3Layer(this AacFlBase that, VRCAvatarDescriptor.AnimLayerType animLayerType) => DoCreateMainLayerOnController(that, animLayerType);
|
||||||
|
|
||||||
|
public static AacFlLayer CreateSupportingFxLayer(this AacFlBase that, string suffix) => DoCreateSupportingLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.FX, suffix);
|
||||||
|
public static AacFlLayer CreateSupportingGestureLayer(this AacFlBase that, string suffix) => DoCreateSupportingLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Gesture, suffix);
|
||||||
|
public static AacFlLayer CreateSupportingActionLayer(this AacFlBase that, string suffix) => DoCreateSupportingLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Action, suffix);
|
||||||
|
public static AacFlLayer CreateSupportingIdleLayer(this AacFlBase that, string suffix) => DoCreateSupportingLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Additive, suffix);
|
||||||
|
public static AacFlLayer CreateSupportingLocomotionLayer(this AacFlBase that, string suffix) => DoCreateSupportingLayerOnController(that, VRCAvatarDescriptor.AnimLayerType.Base, suffix);
|
||||||
|
public static AacFlLayer CreateSupportingAv3Layer(this AacFlBase that, VRCAvatarDescriptor.AnimLayerType animLayerType, string suffix) => DoCreateSupportingLayerOnController(that, animLayerType, suffix);
|
||||||
|
|
||||||
|
private static AacFlLayer DoCreateMainLayerOnController(AacFlBase that, VRCAvatarDescriptor.AnimLayerType animType)
|
||||||
|
{
|
||||||
|
var animator = AnimatorOf(AvatarDescriptor(that), animType);
|
||||||
|
var layerName = that.InternalConfiguration().DefaultsProvider.ConvertLayerName(that.InternalConfiguration().SystemName);
|
||||||
|
|
||||||
|
return that.InternalDoCreateLayer(animator, layerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AacFlLayer DoCreateSupportingLayerOnController(AacFlBase that, VRCAvatarDescriptor.AnimLayerType animType, string suffix)
|
||||||
|
{
|
||||||
|
var animator = AnimatorOf(AvatarDescriptor(that), animType);
|
||||||
|
var layerName = that.InternalConfiguration().DefaultsProvider.ConvertLayerNameWithSuffix(that.InternalConfiguration().SystemName, suffix);
|
||||||
|
|
||||||
|
return that.InternalDoCreateLayer(animator, layerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static AnimatorController AnimatorOf(VRCAvatarDescriptor ad, VRCAvatarDescriptor.AnimLayerType animLayerType)
|
||||||
|
{
|
||||||
|
return (AnimatorController) ad.baseAnimationLayers.First(it => it.type == animLayerType).animatorController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveAllMainLayers(this AacFlBase that)
|
||||||
|
{
|
||||||
|
var layerName = that.InternalConfiguration().SystemName;
|
||||||
|
RemoveLayerOnAllControllers(that, that.InternalConfiguration().DefaultsProvider.ConvertLayerName(layerName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveAllSupportingLayers(this AacFlBase that, string suffix)
|
||||||
|
{
|
||||||
|
var layerName = that.InternalConfiguration().SystemName;
|
||||||
|
RemoveLayerOnAllControllers(that, that.InternalConfiguration().DefaultsProvider.ConvertLayerNameWithSuffix(layerName, suffix));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RemoveLayerOnAllControllers(AacFlBase that, string layerName)
|
||||||
|
{
|
||||||
|
var layers = AvatarDescriptor(that).baseAnimationLayers.Select(layer => layer.animatorController).Where(layer => layer != null).Distinct().ToList();
|
||||||
|
foreach (var customAnimLayer in layers)
|
||||||
|
{
|
||||||
|
new AacAnimatorRemoval((AnimatorController) customAnimLayer).RemoveLayer(that.InternalConfiguration().DefaultsProvider.ConvertLayerName(layerName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static VRCAvatarDescriptor AvatarDescriptor(AacFlBase that)
|
||||||
|
{
|
||||||
|
var foundAvatarDescriptor =
|
||||||
|
that.InternalConfiguration().TryGetAdditionalData(typeof(IAdditionalDataAvatarDescriptor), out var avatarDescriptor);
|
||||||
|
if (!foundAvatarDescriptor)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
"Could not find avatar descriptor in configuration. Invoke .WithAvatarDescriptor(...) on the configuration object");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (VRCAvatarDescriptor)avatarDescriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f4d323b6ed1494ca4034e5d5e992700
|
||||||
|
timeCreated: 1693747417
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "AnimatorAsCodeFramework.V1VRCDestructiveWorkflow",
|
||||||
|
"references": [
|
||||||
|
"GUID:7b32145194168e0409534fc5052b85ce"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": true,
|
||||||
|
"precompiledReferences": [
|
||||||
|
"VRCSDKBase.dll",
|
||||||
|
"VRCSDK3A.dll"
|
||||||
|
],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fab9d4fed7c140bb9801787933ccf7d2
|
||||||
|
timeCreated: 1693747371
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using AnimatorAsCode.V0;
|
using AnimatorAsCode.V1;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.EditMode
|
namespace av3_animator_as_code.Tests.V1.EditMode
|
||||||
{
|
{
|
||||||
public abstract class AbstractSimpleSingleLayerAnimatorInternalEditModeAC
|
public abstract class AbstractSimpleSingleLayerAnimatorInternalEditModeAC
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,6 @@ namespace av3_animator_as_code.Tests.EditMode
|
|||||||
AnimatorRoot = _root.transform,
|
AnimatorRoot = _root.transform,
|
||||||
AssetContainer = _container,
|
AssetContainer = _container,
|
||||||
AssetKey = "None",
|
AssetKey = "None",
|
||||||
AvatarDescriptor = null,
|
|
||||||
DefaultsProvider = new AacDefaultsProvider(),
|
DefaultsProvider = new AacDefaultsProvider(),
|
||||||
SystemName = "Test",
|
SystemName = "Test",
|
||||||
DefaultValueRoot = _root.transform
|
DefaultValueRoot = _root.transform
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using UnityEditor.Animations;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assert = UnityEngine.Assertions.Assert;
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public class AIACAnimatorWideTest : AbstractSimpleSingleLayerAIAC
|
public class AIACAnimatorWideTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using UnityEditor.Animations;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assert = UnityEngine.Assertions.Assert;
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public class AIACBoolTransitionTest : AbstractSimpleSingleLayerAIAC
|
public class AIACBoolTransitionTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using UnityEditor.Animations;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assert = UnityEngine.Assertions.Assert;
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public class AIACStateTest : AbstractSimpleSingleLayerAIAC
|
public class AIACStateTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using UnityEditor.Animations;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assert = UnityEngine.Assertions.Assert;
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public class AIACSubStateMachineTest : AbstractSimpleSingleLayerAIAC
|
public class AIACSubStateMachineTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AnimatorAsCode.V0;
|
using AnimatorAsCode.V1;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assert = UnityEngine.Assertions.Assert;
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public class AIACTransitionFunctionsTest : AbstractSimpleSingleLayerAIAC
|
public class AIACTransitionFunctionsTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using AnimatorAsCode.V1;
|
||||||
using AnimatorAsCode.V0;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
||||||
{
|
{
|
||||||
public abstract class AbstractSimpleSingleLayerAIAC
|
public abstract class AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
@@ -55,7 +53,6 @@ namespace av3_animator_as_code.Tests.PlayMode
|
|||||||
AnimatorRoot = _root.transform,
|
AnimatorRoot = _root.transform,
|
||||||
AssetContainer = _container,
|
AssetContainer = _container,
|
||||||
AssetKey = "None",
|
AssetKey = "None",
|
||||||
AvatarDescriptor = null,
|
|
||||||
DefaultsProvider = new AacDefaultsProvider(),
|
DefaultsProvider = new AacDefaultsProvider(),
|
||||||
SystemName = "Test",
|
SystemName = "Test",
|
||||||
DefaultValueRoot = _root.transform
|
DefaultValueRoot = _root.transform
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using AnimatorAsCode.V0.Extensions.VRChat;
|
using AnimatorAsCode.V1VRC;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using VRC.SDKBase;
|
using VRC.SDKBase;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode.GenerationTests
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode.GenerationTests
|
||||||
{
|
{
|
||||||
public class AIACVRCExtensionsDriverGenerationTest : AbstractSimpleSingleLayerAIAC
|
public class AIACVRCExtensionsDriverGenerationTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using AnimatorAsCode.V0.Extensions.VRChat;
|
using AnimatorAsCode.V1VRC;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using VRC.SDK3.Avatars.Components;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using VRC.SDKBase;
|
using VRC.SDKBase;
|
||||||
|
|
||||||
namespace av3_animator_as_code.Tests.PlayMode.GenerationTests
|
namespace av3_animator_as_code.Tests.V1VRC.PlayMode.GenerationTests
|
||||||
{
|
{
|
||||||
public class AIACVRCExtensionsMiscGenerationTest : AbstractSimpleSingleLayerAIAC
|
public class AIACVRCExtensionsMiscGenerationTest : AbstractSimpleSingleLayerAIAC
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user