From f3d4a5b7601b08ff21699d4d2b53d7a7e5adeb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=C3=AF=7E?= Date: Sun, 3 Sep 2023 15:40:50 +0200 Subject: [PATCH] (MIGRATION) Rename AacV0 to AacV1 --- Examples/AacExample.cs | 2 +- Framework/Editor/V1/Aac.cs | 16 ++--- Framework/Editor/V1/AacFlAnimations.cs | 60 +++++++++---------- ...ractSimpleSingleLayerAnimatorInternalAC.cs | 2 +- .../PlayMode/AbstractSimpleSingleLayerAIAC.cs | 2 +- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Examples/AacExample.cs b/Examples/AacExample.cs index f4b0cca..5a1d613 100644 --- a/Examples/AacExample.cs +++ b/Examples/AacExample.cs @@ -87,7 +87,7 @@ namespace AnimatorAsCodeFramework.Examples /// The AAC base. 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, // In the examples, we consider the avatar to be also the animator root. diff --git a/Framework/Editor/V1/Aac.cs b/Framework/Editor/V1/Aac.cs index cdaec37..c70f13b 100644 --- a/Framework/Editor/V1/Aac.cs +++ b/Framework/Editor/V1/Aac.cs @@ -9,7 +9,7 @@ using Random = UnityEngine.Random; // ReSharper disable once CheckNamespace namespace AnimatorAsCode.V1 { - public static class AacV0 + public static class AacV1 { public static AacFlBase Create(AacConfiguration configuration) { @@ -264,7 +264,7 @@ namespace AnimatorAsCode.V1 { var transform = paths[index]; 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() { - var clip = AacV0.NewClip(_configuration, Guid.NewGuid().ToString()); + var clip = AacV1.NewClip(_configuration, Guid.NewGuid().ToString()); return new AacFlClip(_configuration, clip); } public AacFlClip CopyClip(AnimationClip 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); } public BlendTree NewBlendTreeAsRaw() { - return AacV0.NewBlendTreeAsRaw(_configuration, Guid.NewGuid().ToString()); + return AacV1.NewBlendTreeAsRaw(_configuration, Guid.NewGuid().ToString()); } public AacFlClip NewClip(string name) { - var clip = AacV0.NewClip(_configuration, name); + var clip = AacV1.NewClip(_configuration, name); return new AacFlClip(_configuration, clip); } 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) .Animating(clip => clip.Animates("_ignored", typeof(GameObject), "m_IsActive") @@ -345,7 +345,7 @@ namespace AnimatorAsCode.V1 var numberOf = 1f; 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; return new AacFlClip(_configuration, dummyClip) diff --git a/Framework/Editor/V1/AacFlAnimations.cs b/Framework/Editor/V1/AacFlAnimations.cs index b4d4a36..ffd49fd 100644 --- a/Framework/Editor/V1/AacFlAnimations.cs +++ b/Framework/Editor/V1/AacFlAnimations.cs @@ -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 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; @@ -57,9 +57,9 @@ namespace AnimatorAsCode.V1 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; } @@ -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 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; @@ -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 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, AacV0.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.y"), AacV0.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.x"), AacV1.OneFrame(scale.x)); + AnimationUtility.SetEditorCurve(Clip, AacV1.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.y"), AacV1.OneFrame(scale.y)); + AnimationUtility.SetEditorCurve(Clip, AacV1.Binding(_component, typeof(Transform), component.transform, "m_LocalScale.z"), AacV1.OneFrame(scale.z)); } return this; @@ -92,9 +92,9 @@ namespace AnimatorAsCode.V1 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; } @@ -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 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; @@ -114,16 +114,16 @@ namespace AnimatorAsCode.V1 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; } 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[] { new ObjectReferenceKeyframe { time = 0f, value = material }, @@ -135,7 +135,7 @@ namespace AnimatorAsCode.V1 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[] { new ObjectReferenceKeyframe { time = 0f, value = material }, @@ -170,14 +170,14 @@ namespace AnimatorAsCode.V1 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}); } 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}); } @@ -239,7 +239,7 @@ namespace AnimatorAsCode.V1 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) { - 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) { - 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) { - AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "x" : "r"), AacV0.OneFrame(desiredValue.r)); - AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "y" : "g"), AacV0.OneFrame(desiredValue.g)); - AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "z" : "b"), AacV0.OneFrame(desiredValue.b)); - AnimationUtility.SetEditorCurve(_clip, AacV0.ToSubBinding(binding, _hdr ? "w" : "a"), AacV0.OneFrame(desiredValue.a)); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "x" : "r"), AacV1.OneFrame(desiredValue.r)); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "y" : "g"), AacV1.OneFrame(desiredValue.g)); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "z" : "b"), AacV1.OneFrame(desiredValue.b)); + 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) { - AnimationUtility.SetEditorCurve(_clip, AacV0.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, AacV0.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 ? "x" : "r"), new AnimationCurve(mutatedKeyframesR.ToArray())); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "y" : "g"), new AnimationCurve(mutatedKeyframesG.ToArray())); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "z" : "b"), new AnimationCurve(mutatedKeyframesB.ToArray())); + AnimationUtility.SetEditorCurve(_clip, AacV1.ToSubBinding(binding, _hdr ? "w" : "a"), new AnimationCurve(mutatedKeyframesA.ToArray())); } } } diff --git a/Tests/V1/EditMode/AbstractSimpleSingleLayerAnimatorInternalAC.cs b/Tests/V1/EditMode/AbstractSimpleSingleLayerAnimatorInternalAC.cs index 5ca92fa..846f84d 100644 --- a/Tests/V1/EditMode/AbstractSimpleSingleLayerAnimatorInternalAC.cs +++ b/Tests/V1/EditMode/AbstractSimpleSingleLayerAnimatorInternalAC.cs @@ -35,7 +35,7 @@ namespace av3_animator_as_code.Tests.V1.EditMode protected AacFlBase TestAac() { - return AacV0.Create(new AacConfiguration + return AacV1.Create(new AacConfiguration { AnimatorRoot = _root.transform, AssetContainer = _container, diff --git a/Tests/V1VRC/PlayMode/AbstractSimpleSingleLayerAIAC.cs b/Tests/V1VRC/PlayMode/AbstractSimpleSingleLayerAIAC.cs index d94556d..8d2128b 100644 --- a/Tests/V1VRC/PlayMode/AbstractSimpleSingleLayerAIAC.cs +++ b/Tests/V1VRC/PlayMode/AbstractSimpleSingleLayerAIAC.cs @@ -48,7 +48,7 @@ namespace av3_animator_as_code.Tests.V1VRC.PlayMode protected AacFlBase TestAac() { - return AacV0.Create(new AacConfiguration + return AacV1.Create(new AacConfiguration { AnimatorRoot = _root.transform, AssetContainer = _container,