From 573fc7eaef2e059a4a9f4d82bf5f18c574a8f7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=C3=AF=7E?= Date: Tue, 8 Mar 2022 07:09:32 +0100 Subject: [PATCH] Add AacFlLayer.WithDefaultState(...) to change the default state: - Add WithDefaultState to change the default state of a layer --- Framework/Editor/V0/Aac.cs | 6 ++++++ Framework/Editor/V0/AacFlStates.cs | 6 ++++++ README.md | 1 + 3 files changed, 13 insertions(+) diff --git a/Framework/Editor/V0/Aac.cs b/Framework/Editor/V0/Aac.cs index c0e6d98..8cb92f7 100644 --- a/Framework/Editor/V0/Aac.cs +++ b/Framework/Editor/V0/Aac.cs @@ -239,6 +239,12 @@ namespace AnimatorAsCode.V0 WithAvatarMask(avatarMask); } + + public AacFlLayer WithDefaultState(AacFlState newDefaultState) + { + _stateMachine.WithDefaultState(newDefaultState); + return this; + } } public class AacFlBase diff --git a/Framework/Editor/V0/AacFlStates.cs b/Framework/Editor/V0/AacFlStates.cs index 8ccd1bf..68a2703 100644 --- a/Framework/Editor/V0/AacFlStates.cs +++ b/Framework/Editor/V0/AacFlStates.cs @@ -197,6 +197,12 @@ namespace AnimatorAsCode.V0 { return new Vector3(x * _gridShiftX , y * _gridShiftY, 0); } + + public AacStateMachine WithDefaultState(AacFlState newDefaultState) + { + _machine.defaultState = newDefaultState.State; + return this; + } } public class AacFlState diff --git a/README.md b/README.md index d8f3022..33944ee 100644 --- a/README.md +++ b/README.md @@ -608,6 +608,7 @@ foreach (var cancelWhenNotAllowed in new[] {auto, reverse, manual, custom, done} - `AacFlLayer WithAvatarMask(AvatarMask avatarMask)` /// Set the Avatar Mask of the layer. - `void WithAvatarMaskNoTransforms()` /// Set the Avatar Mask of the layer to be an Avatar Mask which denies all transforms. The asset is generated into the container. - `void ResolveAvatarMask(Transform[] paths)` /// Set the Avatar Mask of the layer to be an Avatar Mask that allows the specified transforms. If `paths` is an empty array, all transforms are denied, which is effectively the same as calling `.WithAvatarMaskNoTransforms()`. The asset is generated into the container. +- `AacFlLayer WithDefaultState(AacFlState newDefaultState)` /// Set the default state of the layer upon entry. # Avatars 3.0 (AacAv3)