Add support for spline point duplicate via Transform gizmo

This commit is contained in:
Wojtek Figat
2021-02-01 16:04:20 +01:00
parent b22805f866
commit c3d9c52f1f
3 changed files with 80 additions and 1 deletions

View File

@@ -169,6 +169,12 @@ float Spline::GetSplineLength() const
return Math::Sqrt(sum);
}
float Spline::GetSplineTime(int32 index) const
{
CHECK_RETURN(index >= 0 && index < GetSplinePointsCount(), 0.0f)
return Curve[index].Time;
}
namespace
{
void FindTimeClosestToPoint(const Vector3& point, const Spline::Keyframe& start, const Spline::Keyframe& end, float& bestDistanceSquared, float& bestTime)

View File

@@ -171,6 +171,13 @@ public:
/// </summary>
API_PROPERTY() float GetSplineLength() const;
/// <summary>
/// Gets the time of the spline keyframe.
/// </summary>
/// <param name="index">The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().</param>
/// <returns>The spline time.</returns>
API_FUNCTION() float GetSplineTime(int32 index) const;
/// <summary>
/// Calculates the closest point to the given location and returns the spline time at that point.
/// </summary>