Compare commits

..
10 Commits
Author SHA1 Message Date
Haï~ ea45f7ef1a Remove UPM installation instructions:
The installation instructions incorrectly assumed that the state of the main branch is in a usable state, but this is a false assumption as all repositories in hai-vr are only tested to be working on release tags.
Redirect to the documentation website instead.
2026-01-31 15:18:07 +01:00
Haï~ 836adc8b60 V1.3.0-alpha.1 Add Modification API, named blend trees overload 2025-08-16 05:32:12 +02:00
Haï~ e16115d9a9 Add Modification API:
- The Modification API is designed specifically for the creation and distribution of modular prefabs, where a developer generates assets on their machine and distributes those generated assets to their users.
  - Add AacFlModification class.
  - Add (AacFlBase).Modification() which returns a AacFlModification.
2025-08-16 05:32:12 +02:00
Haï~ 399b721f4a Add named overload for NewBlendTree() and NewBlendTreeAsRaw():
- Add overload for NewBlendTree() which accepts a name.
- Add overload for NewBlendTreeAsRaw() which accepts a name.
- Addresses #56.
2025-07-11 01:51:45 +02:00
Haï~ 84f7f1d089 V1.2.0 Asset container provider & Final breaking changes 2025-06-23 17:34:24 +02:00
Haï~ 2abc34b61d V1.2.0-beta.2 Safeguard case where AssetContainer is null 2025-06-23 13:47:35 +02:00
Haï~ cfc6c5a9d6 Safeguard case where AssetContainer is null:
- Safeguard a case where AssetContainer is null.
- This covers a known case in Vixen where clips are generated in Edit mode for previews.
2025-06-23 13:46:45 +02:00
yewnyx c87904fbbb Add git url installation note for Unity projects to README (#52). 2025-06-02 02:19:38 +02:00
Tayou 114bea608b Include LICENSE.meta for installing through git url (#55):
- When installing AAC through git url in the Unity package manager (as opposed .unitypackage and ALCOM), the LICENSE file contained within the Packages/ folder would cause errors because files cannot be written there.
- This commit adds the meta file for that LICENSE file, and removes it and other meta files from the exclusion list.
- Original PR comments:

* include LICENSE.meta

generally all meta files should be included. For immutable packages like package registries (e.g. OpenUPM) this is required, as unity can't write a new meta file into the immutable directory. Therefore any files without a meta file will break. Luckily this is just the LICENSE file, no code. but unity still complains

* also include README.md.meta

there is no readme in the package directory. But if there was, its meta file should definitely not be excluded either.
2025-06-02 02:18:31 +02:00
Haï~ 6c16ef567a V1.2.0-beta.1 Asset container provider & Final breaking changes:
- Description for newly introduced code:
  - Add support for third-party asset container management.
    - In preparation for the introduction of [IAssetSaver in NDMF 1.6.0](https://github.com/bdunderscore/ndmf/releases/tag/1.6.0),
      add the ability to delegate the management of the asset container to a third party.
      - No new dependencies are added.
      - By default, the behaviour of Animator As Code is the same as V1.1.0.
    - Add new optional field `AacConfiguration.AssetContainerProvider` to specify an asset container provider.
    - Add new interface `IAacAssetContainerProvider` to abstract asset container management.
  - The above changes have been contributed by **[kb10uy (KOBAYASHI Yū)](https://github.com/kb10uy)** (first contribution).
- (BREAKING) As specified in the changelog for the official release of Animator As Code V1, breaking changes had been planned, and will be applied starting this version:
  - (BREAKING) AacFlSettingKeyframes constructor is now private.
    - For compatibility reasons, it was public for the duration of V1.1.x, and was already marked as obsolete in V1.1.x.
  - (BREAKING) The methods AacFlBase.InternalConfiguration and AacFlBase.InternalDoCreateLayer are now private.
    - For compatibility reasons, it was public for the duration of V1.1.x, and was already marked as obsolete in V1.1.x.
    - The class AacAccessorForExtensions replaced them.
  - These breaking changes are meant to be the last breaking changes for the lifetime of Animator As Code V1.
2024-11-29 12:06:32 +01:00
8 changed files with 152 additions and 6 deletions
@@ -30,5 +30,3 @@ Assembly-CSharp-Editor.csproj
cfe-project.sln.DotSettings.user
VRC.SDKBase.Editor.BuildPipeline.csproj
VRC.SDKBase.Editor.ShaderStripping.csproj
LICENSE.meta
README.md.meta
@@ -522,6 +522,20 @@ namespace AnimatorAsCode.V1
var clip = AacInternals.NewClip(_configuration, name);
return new AacFlClip(_configuration, clip);
}
/// Create a new BlendTree asset with a name. However, the name is only used as a suffix for the asset. The asset is generated into the container.<br/>
/// Added in 1.3.0.
public AacFlNonInitializedBlendTree NewBlendTree(string name)
{
return new AacFlNonInitializedBlendTree(AacInternals.NewBlendTreeAsRaw(_configuration, name));
}
/// Create a new BlendTree asset with a name and returns a native BlendTree object. However, the name is only used as a suffix for the asset. The asset is generated into the container. You may use NewBlendTree() instead to obtain a fluent interface.<br/>
/// Added in 1.3.0.
public BlendTree NewBlendTreeAsRaw(string name)
{
return AacInternals.NewBlendTreeAsRaw(_configuration, name);
}
/// Create a new clip which animates a dummy transform for a specific duration specified in an unit (Frames or Seconds).
public AacFlClip DummyClipLasting(float numberOf, AacFlUnit unit)
@@ -628,6 +642,13 @@ namespace AnimatorAsCode.V1
{
return new AacFlNoAnimator();
}
/// Returns a new AacFlModification instance, granting you access to this destructive modification API. You will need to reuse this object throughout.<br/>
/// Added in 1.3.0.
public AacFlModification Modification()
{
return new AacFlModification(_configuration, this);
}
}
public class AacFlNoAnimator
@@ -23,16 +23,19 @@ namespace AnimatorAsCode.V1
public void SaveAsPersistenceRequired(Object objectToAdd)
{
if (_configuration.AssetContainer == null) return;
if (_configuration.ContainerMode != AacConfiguration.Container.Never) AssetDatabase.AddObjectToAsset(objectToAdd, _configuration.AssetContainer);
}
public void SaveAsRegular(Object objectToAdd)
{
if (_configuration.AssetContainer == null) return;
if (_configuration.ContainerMode == AacConfiguration.Container.Everything) AssetDatabase.AddObjectToAsset(objectToAdd, _configuration.AssetContainer);
}
public void ClearPreviousAssets()
{
if (_configuration.AssetContainer == null) return;
var allSubAssets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_configuration.AssetContainer));
foreach (var subAsset in allSubAssets)
{
@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Animations;
using Object = UnityEngine.Object;
using UnityEngine;
// ReSharper disable once CheckNamespace
namespace AnimatorAsCode.V1
{
public class AacFlModification
{
private readonly AacConfiguration _configuration;
private readonly AacFlBase _base;
private readonly HashSet<Object> _objects = new();
internal AacFlModification(AacConfiguration configuration, AacFlBase originalBase)
{
_configuration = configuration;
_base = originalBase;
}
/// Immediately removes all layers and all parameters from the given AnimatorController, and returns a AacFlController that will edit the given AnimatorController.<br/>
/// This AnimatorController instance is memorized in the current AacFlModification instance memory.<br/>
/// Note: The AnimatorController class is editor-only, so they can't be referenced inside scene components or asset objects. If you have a RuntimeAnimatorController instance, you should cast it to AnimatorController.
public AacFlController ResetAnimatorController(AnimatorController controllerToReset)
{
_objects.Add(controllerToReset);
Internal_ClearAnimatorController(controllerToReset);
return new AacFlController(_configuration, controllerToReset, _base);
}
/// Immediately removes all curves on the clip, and returns a AacFlClip that will edit the given AnimationClip.<br/>
/// This does not reset any other attribute of the clip (e.g., is looping, etc.).<br/>
/// This AnimationClip instance is memorized in the current AacFlModification instance memory.
public AacFlClip ResetClip(AnimationClip clipToReset)
{
_objects.Add(clipToReset);
clipToReset.ClearCurves();
return new AacFlClip(_configuration, clipToReset);
}
/// Immediately clears the list of children in the given BlendTree, sets the parameters to empty strings, and returns a AacFlNonInitializedBlendTree that will edit the given BlendTree.<br/>
/// This does not reset any other attribute of the blend tree (e.g., automatic thresholds, etc.).<br/>
/// This BlendTree instance is memorized in the current AacFlModification instance memory.<br/>
/// Note: The BlendTree class is editor-only, so they can't be referenced inside scene components or asset objects. If you have a Motion instance that is a BlendTree instance, you should cast it to BlendTree.
public AacFlNonInitializedBlendTree ResetBlendTree(BlendTree blendTreeToReset)
{
_objects.Add(blendTreeToReset);
blendTreeToReset.children = Array.Empty<ChildMotion>();
blendTreeToReset.blendParameter = "";
blendTreeToReset.blendParameterY = "";
return new AacFlNonInitializedBlendTree(blendTreeToReset);
}
/// Immediately removes all layers and all parameters from the given AnimatorController.<br/>
/// This AnimatorController instance is memorized in the current AacFlModification instance memory.<br/>
/// Note: The AnimatorController class is editor-only, so they can't be referenced inside scene components or asset objects. If you have a RuntimeAnimatorController instance, you should cast it to AnimatorController.
public AacFlModification ClearAnimatorController(AnimatorController controllerToReset)
{
_objects.Add(controllerToReset);
Internal_ClearAnimatorController(controllerToReset);
return this;
}
/// Returns a AacFlController that will edit the given AnimatorController. This does not reset the AnimatorController.<br/>
/// This AnimatorController instance is memorized in the current AacFlModification instance memory.<br/>
/// Note: The AnimatorController class is editor-only, so they can't be referenced inside scene components or asset objects. If you have a RuntimeAnimatorController instance, you should cast it to AnimatorController.
public AacFlController EditAnimatorController(AnimatorController controllerToReset)
{
_objects.Add(controllerToReset);
return new AacFlController(_configuration, controllerToReset, _base);
}
/// Calls `EditorUtility.SetDirty(...)` on every single AnimatorController, AnimationClip, and BlendTree asset instances previously memorized by this AacFlModification instance.
public void SetDirtyAll()
{
foreach (var obj in _objects)
{
EditorUtility.SetDirty(obj);
}
}
private static void Internal_ClearAnimatorController(AnimatorController controllerToReset)
{
while (controllerToReset.layers.Length > 0)
{
controllerToReset.RemoveLayer(0);
}
var parameters = controllerToReset.parameters;
for (var i = parameters.Length - 1; i >= 0; i--)
{
controllerToReset.RemoveParameter(i);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27af4c404c051cf48bc07b175b4afda7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c04d39cdc2e2392a5b51bfa466760178
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,7 +1,7 @@
{
"name": "dev.hai-vr.animator-as-code.v1",
"displayName": "Animator As Code V1",
"version": "1.1.0",
"version": "1.3.0-alpha.1",
"unity": "2019.4",
"description": "Base Animator As Code library. This library only requires Unity.",
"vrchatVersion" : "2022.1.1",
+1 -3
View File
@@ -17,9 +17,7 @@ Initially created by **[@hai-vr](https://github.com/hai-vr)**,
## Installation
If you are using Animator As Code in VRChat, install using the VRChat Creator Companion or ALCOM. Instructions are available in [this page](https://docs.hai-vr.dev/docs/products/animator-as-code/install).
Otherwise, if you are **not** using VRChat, install it through the [Releases](https://github.com/hai-vr/av3-animator-as-code/releases).
Instructions to install are available in [this page](https://docs.hai-vr.dev/docs/products/animator-as-code/install).
### Documentation