diff --git a/Source/Editor/CustomEditors/Dedicated/SplineEditor.cs b/Source/Editor/CustomEditors/Dedicated/SplineEditor.cs
index d83aa1acc..ca442d66f 100644
--- a/Source/Editor/CustomEditors/Dedicated/SplineEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/SplineEditor.cs
@@ -109,17 +109,6 @@ namespace FlaxEditor.CustomEditors.Dedicated
///
public override void OnSelectTangent(Spline spline, int index) { }
-
- private void SetKeyframeLinear(Spline spline, int index)
- {
- var tangentIn = spline.GetSplineTangent(index, true);
- var tangentOut = spline.GetSplineTangent(index, false);
- tangentIn.Translation = spline.GetSplinePoint(index);
- tangentOut.Translation = spline.GetSplinePoint(index);
- spline.SetSplineTangent(index, tangentIn, true, false);
- spline.SetSplineTangent(index, tangentOut, false, false);
- spline.UpdateSpline();
- }
}
///
@@ -330,7 +319,6 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
var index = _lastPointSelected.Index;
-
var currentTangentInPosition = SelectedSpline.GetSplineLocalTangent(index, true).Translation;
var currentTangentOutPosition = SelectedSpline.GetSplineLocalTangent(index, false).Translation;
@@ -621,6 +609,24 @@ namespace FlaxEditor.CustomEditors.Dedicated
return keyframe.TangentOut.Translation.Length > 0 && keyframe.TangentIn.Translation.Length == 0;
}
+ private static void SetKeyframeLinear(Spline spline, int index)
+ {
+ var keyframe = spline.GetSplineKeyframe(index);
+ keyframe.TangentIn.Translation = Vector3.Zero;
+ keyframe.TangentOut.Translation = Vector3.Zero;
+
+ var lastSplineIndex = spline.SplinePointsCount - 1;
+ if (index == lastSplineIndex && spline.IsLoop)
+ {
+ var lastPoint = spline.GetSplineKeyframe(lastSplineIndex);
+ lastPoint.TangentIn.Translation = Vector3.Zero;
+ lastPoint.TangentOut.Translation = Vector3.Zero;
+ spline.SetSplineKeyframe(lastSplineIndex, lastPoint);
+ }
+
+ spline.SetSplineKeyframe(index, keyframe);
+ }
+
private static void SetTangentSmoothIn(Spline spline, int index)
{
var keyframe = spline.GetSplineKeyframe(index);
diff --git a/Source/Editor/SceneGraph/Actors/SplineNode.cs b/Source/Editor/SceneGraph/Actors/SplineNode.cs
index 3ba1d14c3..1c47c7d98 100644
--- a/Source/Editor/SceneGraph/Actors/SplineNode.cs
+++ b/Source/Editor/SceneGraph/Actors/SplineNode.cs
@@ -257,6 +257,7 @@ namespace FlaxEditor.SceneGraph.Actors
public override void OnDebugDraw(ViewportDebugDrawData data)
{
+ Debug.Log(Name);
// Draw spline and spline point
ParentNode.OnDebugDraw(data);