(MIGRATION) Rename AacV0 to AacV1
This commit is contained in:
@@ -87,7 +87,7 @@ namespace AnimatorAsCodeFramework.Examples
|
|||||||
/// <returns>The AAC base.</returns>
|
/// <returns>The AAC base.</returns>
|
||||||
public static AacFlBase AnimatorAsCode(string systemName, VRCAvatarDescriptor avatar, AnimatorController assetContainer, string assetKey, TemplateGenOptions options)
|
public static AacFlBase AnimatorAsCode(string systemName, VRCAvatarDescriptor avatar, AnimatorController assetContainer, string assetKey, TemplateGenOptions options)
|
||||||
{
|
{
|
||||||
var aac = AacV0.Create(new AacConfiguration
|
var aac = AacV1.Create(new AacConfiguration
|
||||||
{
|
{
|
||||||
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.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Random = UnityEngine.Random;
|
|||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace AnimatorAsCode.V1
|
namespace AnimatorAsCode.V1
|
||||||
{
|
{
|
||||||
public static class AacV0
|
public static class AacV1
|
||||||
{
|
{
|
||||||
public static AacFlBase Create(AacConfiguration configuration)
|
public static AacFlBase Create(AacConfiguration configuration)
|
||||||
{
|
{
|
||||||
@@ -264,7 +264,7 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
var transform = paths[index];
|
var transform = paths[index];
|
||||||
avatarMask.SetTransformActive(index, true);
|
avatarMask.SetTransformActive(index, true);
|
||||||
avatarMask.SetTransformPath(index, AacV0.ResolveRelativePath(_configuration.AnimatorRoot, transform));
|
avatarMask.SetTransformPath(index, AacV1.ResolveRelativePath(_configuration.AnimatorRoot, transform));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,31 +303,31 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlClip NewClip()
|
public AacFlClip NewClip()
|
||||||
{
|
{
|
||||||
var clip = AacV0.NewClip(_configuration, Guid.NewGuid().ToString());
|
var clip = AacV1.NewClip(_configuration, Guid.NewGuid().ToString());
|
||||||
return new AacFlClip(_configuration, clip);
|
return new AacFlClip(_configuration, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AacFlClip CopyClip(AnimationClip originalClip)
|
public AacFlClip CopyClip(AnimationClip originalClip)
|
||||||
{
|
{
|
||||||
var newClip = UnityEngine.Object.Instantiate(originalClip);
|
var newClip = UnityEngine.Object.Instantiate(originalClip);
|
||||||
var clip = AacV0.RegisterClip(_configuration, Guid.NewGuid().ToString(), newClip);
|
var clip = AacV1.RegisterClip(_configuration, Guid.NewGuid().ToString(), newClip);
|
||||||
return new AacFlClip(_configuration, clip);
|
return new AacFlClip(_configuration, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlendTree NewBlendTreeAsRaw()
|
public BlendTree NewBlendTreeAsRaw()
|
||||||
{
|
{
|
||||||
return AacV0.NewBlendTreeAsRaw(_configuration, Guid.NewGuid().ToString());
|
return AacV1.NewBlendTreeAsRaw(_configuration, Guid.NewGuid().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public AacFlClip NewClip(string name)
|
public AacFlClip NewClip(string name)
|
||||||
{
|
{
|
||||||
var clip = AacV0.NewClip(_configuration, name);
|
var clip = AacV1.NewClip(_configuration, name);
|
||||||
return new AacFlClip(_configuration, clip);
|
return new AacFlClip(_configuration, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AacFlClip DummyClipLasting(float numberOf, AacFlUnit unit)
|
public AacFlClip DummyClipLasting(float numberOf, AacFlUnit unit)
|
||||||
{
|
{
|
||||||
var dummyClip = AacV0.NewClip(_configuration, $"D({numberOf} {Enum.GetName(typeof(AacFlUnit), unit)})");
|
var dummyClip = AacV1.NewClip(_configuration, $"D({numberOf} {Enum.GetName(typeof(AacFlUnit), unit)})");
|
||||||
|
|
||||||
return new AacFlClip(_configuration, dummyClip)
|
return new AacFlClip(_configuration, dummyClip)
|
||||||
.Animating(clip => clip.Animates("_ignored", typeof(GameObject), "m_IsActive")
|
.Animating(clip => clip.Animates("_ignored", typeof(GameObject), "m_IsActive")
|
||||||
@@ -345,7 +345,7 @@ namespace AnimatorAsCode.V1
|
|||||||
var numberOf = 1f;
|
var numberOf = 1f;
|
||||||
var unit = AacFlUnit.Frames;
|
var unit = AacFlUnit.Frames;
|
||||||
|
|
||||||
var dummyClip = AacV0.NewClip(_configuration, $"D({numberOf} {Enum.GetName(typeof(AacFlUnit), unit)})");
|
var dummyClip = AacV1.NewClip(_configuration, $"D({numberOf} {Enum.GetName(typeof(AacFlUnit), unit)})");
|
||||||
|
|
||||||
var duration = unit == AacFlUnit.Frames ? numberOf / 60f : numberOf;
|
var duration = unit == AacFlUnit.Frames ? numberOf / 60f : numberOf;
|
||||||
return new AacFlClip(_configuration, dummyClip)
|
return new AacFlClip(_configuration, dummyClip)
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ namespace AnimatorAsCode.V1
|
|||||||
var defensiveObjects = gameObjectsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
var defensiveObjects = gameObjectsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
||||||
foreach (var component in defensiveObjects)
|
foreach (var component in defensiveObjects)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(GameObject), component.transform, "m_IsActive");
|
var binding = AacV1.Binding(_component, typeof(GameObject), component.transform, "m_IsActive");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value ? 1f : 0f));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value ? 1f : 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -57,9 +57,9 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlClip BlendShape(SkinnedMeshRenderer renderer, string blendShapeName, float value)
|
public AacFlClip BlendShape(SkinnedMeshRenderer renderer, string blendShapeName, float value)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(SkinnedMeshRenderer), renderer.transform, $"blendShape.{blendShapeName}");
|
var binding = AacV1.Binding(_component, typeof(SkinnedMeshRenderer), renderer.transform, $"blendShape.{blendShapeName}");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,9 @@ namespace AnimatorAsCode.V1
|
|||||||
var defensiveObjects = rendererWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
var defensiveObjects = rendererWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
||||||
foreach (var component in defensiveObjects)
|
foreach (var component in defensiveObjects)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(SkinnedMeshRenderer), component.transform, $"blendShape.{blendShapeName}");
|
var binding = AacV1.Binding(_component, typeof(SkinnedMeshRenderer), component.transform, $"blendShape.{blendShapeName}");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -82,9 +82,9 @@ namespace AnimatorAsCode.V1
|
|||||||
var defensiveObjects = gameObjectsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
var defensiveObjects = gameObjectsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
||||||
foreach (var component in defensiveObjects)
|
foreach (var component in defensiveObjects)
|
||||||
{
|
{
|
||||||
AnimationUtility.SetEditorCurve(Clip, AacV0.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.x"), AacV0.OneFrame(scale.x));
|
AnimationUtility.SetEditorCurve(Clip, AacV1.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.x"), AacV1.OneFrame(scale.x));
|
||||||
AnimationUtility.SetEditorCurve(Clip, AacV0.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.y"), AacV0.OneFrame(scale.y));
|
AnimationUtility.SetEditorCurve(Clip, AacV1.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.y"), AacV1.OneFrame(scale.y));
|
||||||
AnimationUtility.SetEditorCurve(Clip, AacV0.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.z"), AacV0.OneFrame(scale.z));
|
AnimationUtility.SetEditorCurve(Clip, AacV1.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.z"), AacV1.OneFrame(scale.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -92,9 +92,9 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlClip Toggling(GameObject gameObject, bool value)
|
public AacFlClip Toggling(GameObject gameObject, bool value)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(GameObject), gameObject.transform, "m_IsActive");
|
var binding = AacV1.Binding(_component, typeof(GameObject), gameObject.transform, "m_IsActive");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value ? 1f : 0f));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value ? 1f : 0f));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -104,9 +104,9 @@ namespace AnimatorAsCode.V1
|
|||||||
var defensiveComponents = componentsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
var defensiveComponents = componentsWithNulls.Where(o => o != null); // Allow users to remove an item in the middle of the array
|
||||||
foreach (var component in defensiveComponents)
|
foreach (var component in defensiveComponents)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, component.GetType(), component.transform, "m_Enabled");
|
var binding = AacV1.Binding(_component, component.GetType(), component.transform, "m_Enabled");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value ? 1f : 0f));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value ? 1f : 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -114,16 +114,16 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlClip TogglingComponent(Component component, bool value)
|
public AacFlClip TogglingComponent(Component component, bool value)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, component.GetType(), component.transform, "m_Enabled");
|
var binding = AacV1.Binding(_component, component.GetType(), component.transform, "m_Enabled");
|
||||||
|
|
||||||
AnimationUtility.SetEditorCurve(Clip, binding, AacV0.OneFrame(value ? 1f : 0f));
|
AnimationUtility.SetEditorCurve(Clip, binding, AacV1.OneFrame(value ? 1f : 0f));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AacFlClip SwappingMaterial(Renderer renderer, int slot, Material material)
|
public AacFlClip SwappingMaterial(Renderer renderer, int slot, Material material)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, renderer.GetType(), renderer.transform, $"m_Materials.Array.data[{slot}]");
|
var binding = AacV1.Binding(_component, renderer.GetType(), renderer.transform, $"m_Materials.Array.data[{slot}]");
|
||||||
|
|
||||||
AnimationUtility.SetObjectReferenceCurve(Clip, binding, new[] {
|
AnimationUtility.SetObjectReferenceCurve(Clip, binding, new[] {
|
||||||
new ObjectReferenceKeyframe { time = 0f, value = material },
|
new ObjectReferenceKeyframe { time = 0f, value = material },
|
||||||
@@ -135,7 +135,7 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlClip SwappingMaterial(ParticleSystem particleSystem, int slot, Material material)
|
public AacFlClip SwappingMaterial(ParticleSystem particleSystem, int slot, Material material)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(ParticleSystemRenderer), particleSystem.transform, $"m_Materials.Array.data[{slot}]");
|
var binding = AacV1.Binding(_component, typeof(ParticleSystemRenderer), particleSystem.transform, $"m_Materials.Array.data[{slot}]");
|
||||||
|
|
||||||
AnimationUtility.SetObjectReferenceCurve(Clip, binding, new[] {
|
AnimationUtility.SetObjectReferenceCurve(Clip, binding, new[] {
|
||||||
new ObjectReferenceKeyframe { time = 0f, value = material },
|
new ObjectReferenceKeyframe { time = 0f, value = material },
|
||||||
@@ -170,14 +170,14 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
public AacFlSettingCurve Animates(Transform transform, Type type, string propertyName)
|
public AacFlSettingCurve Animates(Transform transform, Type type, string propertyName)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, type, transform, propertyName);
|
var binding = AacV1.Binding(_component, type, transform, propertyName);
|
||||||
|
|
||||||
return new AacFlSettingCurve(Clip, new[] {binding});
|
return new AacFlSettingCurve(Clip, new[] {binding});
|
||||||
}
|
}
|
||||||
|
|
||||||
public AacFlSettingCurve Animates(GameObject gameObject)
|
public AacFlSettingCurve Animates(GameObject gameObject)
|
||||||
{
|
{
|
||||||
var binding = AacV0.Binding(_component, typeof(GameObject), gameObject.transform, "m_IsActive");
|
var binding = AacV1.Binding(_component, typeof(GameObject), gameObject.transform, "m_IsActive");
|
||||||
|
|
||||||
return new AacFlSettingCurve(Clip, new[] {binding});
|
return new AacFlSettingCurve(Clip, new[] {binding});
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
private EditorCurveBinding Internal_BindingFromComponent(Component anyComponent, string propertyName)
|
private EditorCurveBinding Internal_BindingFromComponent(Component anyComponent, string propertyName)
|
||||||
{
|
{
|
||||||
return AacV0.Binding(_component, anyComponent.GetType(), anyComponent.transform, propertyName);
|
return AacV1.Binding(_component, anyComponent.GetType(), anyComponent.transform, propertyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
foreach (var binding in _bindings)
|
foreach (var binding in _bindings)
|
||||||
{
|
{
|
||||||
AnimationUtility.SetEditorCurve(_clip, binding, AacV0.OneFrame(desiredValue));
|
AnimationUtility.SetEditorCurve(_clip, binding, AacV1.OneFrame(desiredValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
foreach (var binding in _bindings)
|
foreach (var binding in _bindings)
|
||||||
{
|
{
|
||||||
AnimationUtility.SetEditorCurve(_clip, binding, AacV0.ConstantSeconds(seconds, desiredValue));
|
AnimationUtility.SetEditorCurve(_clip, binding, AacV1.ConstantSeconds(seconds, desiredValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,10 +323,10 @@ namespace AnimatorAsCode.V1
|
|||||||
{
|
{
|
||||||
foreach (var binding in _bindings)
|
foreach (var binding in _bindings)
|
||||||
{
|
{
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "x" : "r"), AacV0.OneFrame(desiredValue.r));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "x" : "r"), AacV1.OneFrame(desiredValue.r));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "y" : "g"), AacV0.OneFrame(desiredValue.g));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "y" : "g"), AacV1.OneFrame(desiredValue.g));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "z" : "b"), AacV0.OneFrame(desiredValue.b));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "z" : "b"), AacV1.OneFrame(desiredValue.b));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "w" : "a"), AacV0.OneFrame(desiredValue.a));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "w" : "a"), AacV1.OneFrame(desiredValue.a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,10 +341,10 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
foreach (var binding in _bindings)
|
foreach (var binding in _bindings)
|
||||||
{
|
{
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "x" : "r"), new AnimationCurve(mutatedKeyframesR.ToArray()));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "x" : "r"), new AnimationCurve(mutatedKeyframesR.ToArray()));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "y" : "g"), new AnimationCurve(mutatedKeyframesG.ToArray()));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "y" : "g"), new AnimationCurve(mutatedKeyframesG.ToArray()));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "z" : "b"), new AnimationCurve(mutatedKeyframesB.ToArray()));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "z" : "b"), new AnimationCurve(mutatedKeyframesB.ToArray()));
|
||||||
AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "w" : "a"), new AnimationCurve(mutatedKeyframesA.ToArray()));
|
AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "w" : "a"), new AnimationCurve(mutatedKeyframesA.ToArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace av3_animator_as_code.Tests.V1.EditMode
|
|||||||
|
|
||||||
protected AacFlBase TestAac()
|
protected AacFlBase TestAac()
|
||||||
{
|
{
|
||||||
return AacV0.Create(new AacConfiguration
|
return AacV1.Create(new AacConfiguration
|
||||||
{
|
{
|
||||||
AnimatorRoot = _root.transform,
|
AnimatorRoot = _root.transform,
|
||||||
AssetContainer = _container,
|
AssetContainer = _container,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace av3_animator_as_code.Tests.V1VRC.PlayMode
|
|||||||
|
|
||||||
protected AacFlBase TestAac()
|
protected AacFlBase TestAac()
|
||||||
{
|
{
|
||||||
return AacV0.Create(new AacConfiguration
|
return AacV1.Create(new AacConfiguration
|
||||||
{
|
{
|
||||||
AnimatorRoot = _root.transform,
|
AnimatorRoot = _root.transform,
|
||||||
AssetContainer = _container,
|
AssetContainer = _container,
|
||||||
|
|||||||
Reference in New Issue
Block a user