(BREAKING) Add AnimatorAsCode V1:

- Breaking changes:
  - Remove dependency to VRChat in the AnimatorAsCode.V1 namespace. The namespace should now be usable in non-VRChat projects.
  - All VRChat-specific methods are now extension functions in a separate namespace, AnimatorAsCode.V1.VRC.
  - VRChat methods that modify existing assets are split into a separate namespace, AnimatorAsCode.V1.VRCDestructiveWorkflow.
- Breaking fixes:
  - Fix incorrect type signature on AacFlFloatParameterGroup.ToList() and AacFlIntParameterGroup.ToList().
- Add AacFlBase.NewBlendTree():
  - This allows creating blend trees as code.
  - Add AacFlState.WithAnimation(AacFlBlendTree).
- Add AacFlBase.NoAnimator():
  - This can be used to obtain AacFlParameter objects for use in the generation of BlendTrees and other systems, without requiring the existence of a backing animator controller.
  - This can also be used in some cases where there are type casts (Bool to Float, Float to Bool).
- Add AacFlBase.NewAnimatorController():
  - This is meant to be used for non-destructive workflows.
  - This creates an animator controller inside the asset container. This animator controller will be reaped in the same way as other assets are reaped.
This commit is contained in:
Haï~
2023-10-02 04:51:07 +02:00
parent 3f5fd7aff7
commit d22d73cc82
10 changed files with 483 additions and 169 deletions
+63
View File
@@ -0,0 +1,63 @@
Migrating from V0 to V1
======
AnimatorAsCode V1 introduces the following main breaking changes:
- VRChat Avatars is now an optional dependency. AnimatorAsCode can now be used in non-VRChat projects.
- All VRChat-related functions have been split between two classes of extension methods.
- You are now encouraged to use a non-destructive workflow by generating an animator controller asset without relying on an existing animator controller asset.
- VRChat methods that use a destructive workflow, such as `AacFlBase.CreateMainFxLayer()` are located on their own class of extension methods.
## Assembly definition
If you use assembly definitions, change the assembly reference from `AnimatorAsCodeFramework` to the following:
- `AnimatorAsCodeFramework.V1` in all cases.
- `AnimatorAsCodeFramework.V1.VRC` if you depend on VRChat.
- `AnimatorAsCodeFramework.V1.VRCDestructiveWorkflow` also if you need to edit the playable layers of the avatar directly.
- *Consider switching to a non-destructive workflow using VRCFury or Modular Avatar! See below.*
## Code changes
### Code
- Change `AacV0` to `AacV1`
- Change `using AnimatorAsCode.V0;` to `using AnimatorAsCode.V1;`
- If your project depends on VRChat, you will need to use extension methods.
- Add `using AnimatorAsCode.V1.VRC;` in your class imports to use the VRChat extension methods.
- The extension methods are contained within the class `AnimatorAsCode.V1.VRC.AacVRCExtensions`.
- Add `using AnimatorAsCode.V1.VRC;` in your class imports to use the extension methods.
- The extension methods are contained within the class `AnimatorAsCode.V1.VRCDestructiveWorkflow.AacVRCDestructiveWorkflowExtensions`
# TODO
- TODO: Check TrackingElement being renamed to AacAv3.Av3TrackingElement
### AacConfiguration
Since `AacConfiguration` no longer contains the avatar descriptor, you will need to use the extension method `AacConfiguration.WithAvatarDescriptor(VRCAvatarDescriptor)` to define the avatar in the configuration.
For example:
```csharp
using AnimatorAsCode.V1;
using AnimatorAsCode.V1.VRCDestructiveWorkflow;
// ...
AacV1.Create(new AacConfiguration
{
SystemName = systemName,
AnimatorRoot = avatar.transform,
DefaultValueRoot = avatar.transform,
AssetContainer = assetContainer,
AssetKey = assetKey,
DefaultsProvider = new AacDefaultsProvider(writeDefaults: options.WriteDefaults)
}.WithAvatarDescriptor(avatar)); // The avatar descriptor is now defined by invoking an extension method.
```
# Non-destructive workflow
Animator As Code V1 encourages the use of a non-destructive workflow.
Here's a quick example:
Please open the file `Examples/GenExample4_NonDestructiveWorkflow.cs`.