From 508b458fba0493dfe5b2674cb53126e3e60ca480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=C3=AF=7E?= Date: Sat, 12 Mar 2022 22:38:56 +0100 Subject: [PATCH] Add AacFlState.WithCycleOffset(...), WithCycleOffsetSetTo, and WithSpeedSetTo: - Add AacFlState.WithCycleOffset(...) - Add AacFlState.WithCycleOffsetSetTo(...) which takes a fixed value. - Add AacFlState.WithSpeedSetTo(...) which takes a fixed value. AacFlState.WithSpeed(...) already exists. --- Framework/Editor/V0/AacFlStates.cs | 26 +++++++++++++++++++++++++- README.md | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Framework/Editor/V0/AacFlStates.cs b/Framework/Editor/V0/AacFlStates.cs index 4f21604..0754e37 100644 --- a/Framework/Editor/V0/AacFlStates.cs +++ b/Framework/Editor/V0/AacFlStates.cs @@ -536,6 +536,22 @@ namespace AnimatorAsCode.V0 return this; } + public AacFlState WithCycleOffset(AacFlFloatParameter floatParam) + { + State.cycleOffsetParameterActive = false; + State.cycleOffsetParameter = floatParam.Name; + + return this; + } + + public AacFlState WithCycleOffsetSetTo(float cycleOffset) + { + State.cycleOffsetParameterActive = false; + State.cycleOffset = cycleOffset; + + return this; + } + private void SettingElementTo(TrackingElement element, VRC_AnimatorTrackingControl.TrackingType target) { switch (element) @@ -604,8 +620,16 @@ namespace AnimatorAsCode.V0 public AacFlState WithSpeed(AacFlFloatParameter parameter) { - State.speedParameter = parameter.Name; State.speedParameterActive = true; + State.speedParameter = parameter.Name; + + return this; + } + + public AacFlState WithSpeedSetTo(float speed) + { + State.speedParameterActive = false; + State.speed = speed; return this; } diff --git a/README.md b/README.md index f3898db..963c04d 100644 --- a/README.md +++ b/README.md @@ -668,7 +668,10 @@ foreach (var cancelWhenNotAllowed in new[] {auto, reverse, manual, custom, done} - `AacFlState WithAnimation(AacFlClip clip)` /// Set a specific clip for the state. See `(AacFlBase).NewClip()` and similar. - `AacFlState MotionTime(AacFlFloatParameter floatParam)` /// Set the Motion Time, formerly known as Normalized Time. - `AacFlState WithSpeed(AacFlFloatParameter parameter)` /// Set the Speed. +- `AacFlState WithSpeedSetTo(float speed)` /// Set the Speed to a specific value. - `AacFlState WithWriteDefaultsSetTo(bool shouldWriteDefaults)` /// Set Write Defaults. If you need to do this to many states, consider changing the AacConfiguration DefaultsProvider when creating Animator As Code. +- `AacFlState WithCycleOffset(AacFlFloatParameter floatParam)` /// Set the Cycle Offset. +- `AacFlState WithCycleOffsetSetTo(float cycleOffset)` /// Set the Cycle Offset to a specific value. ## Transitions