mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using AssetRipper.SourceGenerated.Extensions.Enums.Keyframe;
|
|
using AssetRipper.SourceGenerated.Extensions.Enums.Keyframe.TangentMode;
|
|
using AssetRipper.SourceGenerated.Subclasses.Keyframe_Single;
|
|
|
|
namespace AssetRipper.SourceGenerated.Extensions
|
|
{
|
|
public static partial class KeyframeExtensions
|
|
{
|
|
public const float DefaultFloatWeight = (float)(1.0 / 3.0);
|
|
|
|
public static void SetValues(this IKeyframe_Single keyframe, UnityVersion version, float time, float value, float weight)
|
|
{
|
|
keyframe.Time = time;
|
|
keyframe.Value = value;
|
|
// this enum member is version agnostic
|
|
keyframe.TangentMode = TangentMode.FreeSmooth.ToTangent(version);
|
|
keyframe.WeightedMode = (int)WeightedMode.None;
|
|
keyframe.InWeight = weight;
|
|
keyframe.OutWeight = weight;
|
|
}
|
|
|
|
public static void SetValues(this IKeyframe_Single keyframe, UnityVersion version, float time, float value, float inSlope, float outSlope, float weight)
|
|
{
|
|
keyframe.Time = time;
|
|
keyframe.Value = value;
|
|
keyframe.InSlope = inSlope;
|
|
keyframe.OutSlope = outSlope;
|
|
// this enum member is version agnostic
|
|
keyframe.TangentMode = TangentMode.FreeFree.ToTangent(version);
|
|
keyframe.WeightedMode = (int)WeightedMode.None;
|
|
keyframe.InWeight = weight;
|
|
keyframe.OutWeight = weight;
|
|
}
|
|
}
|
|
}
|