Personal extensions and utilities for Animator As Code.
Most of these will probably make no sense outside of my specific workflow, however perhaps they may be helpful as inspiration for your own code.
Take a look at the example script for an idea on how to use the utils library.
Hai if you're reading this, turn back now, lest my code make your skeleton cringe out of your body lol.
AACUtils.cs - Basic Usage
- Add a reference to my Assembly Definition to yours (see the example). If you don't already have an Assembly Definition for your code, you should probably make one.
- Add
using LackofbindingsAAC;to your script. - Somewhere in your script after instantiating AAC and making your first layer, you should create an instance of my utils class and pass in a reference to your AacFlBase, your main AacFlController, and your main AacFlLayer.
_utils = new AACUtils(aac, controller, layer);.- These references are all for functions that rely on an existing animator or animator layer, (creating params, animator layers, etc.), but where which exact layer doesn't matter. (For instance, creating a parameter requires a reference to an animator layer, even though it applies to the entire animator).
- Confusingly, AAC uses the word "layer" to refer to both animator layers, as well as animators themselves. I try to use "layer" to only refer to the layers inside an animator.
- If your script makes more than one AacFlController. you will need a new instance of utils for each. Hopefully I can streamline that in the future.
- You can now use that instance to call any of my utility functions from inside your generator.
This package also includes an extension class for AAC that includes a few QoL functions.
AacFlBase.NewBlendTree(string name)- To create a new blend tree while providing a name like you can with clips.AacFlEditClip.AnimatesScaleWIthOneFrame(Transform transform, float scale)- To quickly animate uniform scale.AacFlBase.ClearOutController(AnimatorController controller)- To quickly clear all layers, params, and aac-created sub-assets from a controller. (Only relevant to my janky workflow).AacFlBase.ClearPreviousAssetsAll()- Just like ClearPreviousAssets() but also clears animation controllers. This is only useful if you are using my AACAssetContainer.
This package also includes an ScriptableAsset that is designed to ease using animators generated by AAC as regular animators. It provides named proxy animator controller sub-assets that each mirror an AAC generated animator. This allows you to reference an animator in other tools (such as VRCFury) with a consistent GUID between generations.
- Create a new AACAssetContainer from
Create > Lackofbindings > AAC > AssetContainerand assign it as your asset container in your generator when calling AacV1.Create(). - In your generator script, before generating anything call
aac.ClearPreviousAssetsAll();to remove all sub-assets generated by AAC. - At the end of your generator, call
assetContainer.updateAnimator("Foo", controller.AnimatorController);to have the AACAssetContainer copy the animator to the proxy animator with the same name, thus preserving a consistent GUID.
Depends on Animator as Code by Hai, as well as the VRChat Avatars SDK 3.
Make sure you have the AAC repo added to your VCC first. The VCC should install these automatically alongside this package as long as you have their repo added first.
Then you can install this package using the VRChat Creator Companion either via the Listing Page or a direct link to the index.json.