don't let aligned or free mode on first or end spline point

This commit is contained in:
Ruan Lucas
2023-07-21 21:05:36 -04:00
parent 6872f35add
commit 1bd7210107

View File

@@ -318,9 +318,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
UpdateSelectedPoint();
UpdateSelectedTangent();
_freeTangentButton.Button.Enabled = CanSetTangentMode();
_freeTangentButton.Button.Enabled = CanSetTangentFree();
_linearTangentButton.Button.Enabled = CanSetTangentMode();
_alignedTangentButton.Button.Enabled = CanSetTangentMode();
_alignedTangentButton.Button.Enabled = CanSetTangentAligned();
_smoothInTangentButton.Button.Enabled = CanSetTangentSmoothIn();
_smoothOutTangentButton.Button.Enabled = CanSetTangentSmoothOut();
@@ -376,6 +376,18 @@ namespace FlaxEditor.CustomEditors.Dedicated
return _lastPointSelected.Index < SelectedSpline.SplinePointsCount - 1;
}
private bool CanSetTangentFree()
{
if (!CanSetTangentMode()) return false;
return _lastPointSelected.Index < SelectedSpline.SplinePointsCount - 1 && _lastPointSelected.Index != 0;
}
private bool CanSetTangentAligned()
{
if (!CanSetTangentMode()) return false;
return _lastPointSelected.Index < SelectedSpline.SplinePointsCount - 1 && _lastPointSelected.Index != 0;
}
private void SetModeLinear()
{
_currentTangentMode = new LinearTangentMode();