Merge branch 'SplineEditorImprovements' of https://github.com/xxSeys1/FlaxEngine into xxSeys1-SplineEditorImprovements
This commit is contained in:
@@ -18,7 +18,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
public class SplineEditor : ActorEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Storage undo spline data
|
||||
/// Stores undo spline data.
|
||||
/// </summary>
|
||||
private struct UndoData
|
||||
{
|
||||
@@ -83,7 +83,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve as free mode
|
||||
/// Edit curve options manipulate the curve as free mode.
|
||||
/// </summary>
|
||||
private sealed class FreeTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options to set tangents to linear
|
||||
/// Edit curve options to set tangents to linear.
|
||||
/// </summary>
|
||||
private sealed class LinearTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -107,13 +107,13 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
SetKeyframeLinear(spline, index);
|
||||
|
||||
// change the selection to tangent parent (a spline point / keyframe)
|
||||
// Change the selection to tangent parent (a spline point / keyframe)
|
||||
Editor.SetSelectSplinePointNode(spline, index);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options to align tangents of selected spline
|
||||
/// Edit curve options to align tangents of selected spline.
|
||||
/// </summary>
|
||||
private sealed class AlignedTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -168,8 +168,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve setting selected point
|
||||
/// tangent in as smoothed but tangent out as linear
|
||||
/// Edit curve options manipulate the curve setting selected point tangent in as smoothed but tangent out as linear.
|
||||
/// </summary>
|
||||
private sealed class SmoothInTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -182,8 +181,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve setting selected point
|
||||
/// tangent in as linear but tangent out as smoothed
|
||||
/// Edit curve options manipulate the curve setting selected point tangent in as linear but tangent out as smoothed.
|
||||
/// </summary>
|
||||
private sealed class SmoothOutTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -219,7 +217,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var enabled = EnabledInHierarchy && tab.EnabledInHierarchy;
|
||||
var style = FlaxEngine.GUI.Style.Current;
|
||||
var size = Size;
|
||||
var textHeight = 16.0f;
|
||||
var textHeight = 30.0f;
|
||||
// Make icons smaller when tabs get thinner
|
||||
var iconSize = size.Y - textHeight;
|
||||
var iconRect = new Rectangle((Width - iconSize) / 2, 0, iconSize, iconSize);
|
||||
if (tab._mirrorIcon)
|
||||
@@ -230,8 +229,11 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var color = style.Foreground;
|
||||
if (!enabled)
|
||||
color *= 0.6f;
|
||||
var textRect = new Rectangle(0, size.Y - textHeight, size.X, textHeight);
|
||||
Render2D.PushClip(new Rectangle(Float2.Zero, Size));
|
||||
Render2D.DrawSprite(tab._customIcon, iconRect, color);
|
||||
Render2D.DrawText(style.FontMedium, tab._customText, new Rectangle(0, iconSize, size.X, textHeight), color, TextAlignment.Center, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, tab._customText, textRect, color, TextAlignment.Center, TextAlignment.Center, TextWrapping.WrapWords, 0.65f);
|
||||
Render2D.PopClip();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,18 +293,21 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
return;
|
||||
_selectedSpline = spline;
|
||||
|
||||
layout.Space(10);
|
||||
var tabSize = 46;
|
||||
//var tabSize = 46;
|
||||
var tabSize = 60;
|
||||
var icons = Editor.Instance.Icons;
|
||||
|
||||
layout.Header("Selected spline point");
|
||||
var group = layout.Group("Selected Point");
|
||||
_selectedPointsTabs = new Tabs
|
||||
{
|
||||
Height = tabSize,
|
||||
TabsSize = new Float2(tabSize),
|
||||
AutoTabsSize = true,
|
||||
Parent = layout.ContainerControl,
|
||||
Parent = group.ContainerControl,
|
||||
};
|
||||
// Move the group above the group containing spline points
|
||||
group.Control.IndexInParent = 3;
|
||||
|
||||
_linearTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedLinear, "Linear", icons.SplineLinear64));
|
||||
_freeTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedFree, "Free", icons.SplineFree64));
|
||||
_alignedTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedAligned, "Aligned", icons.SplineAligned64));
|
||||
@@ -310,13 +315,13 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
_smoothOutTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedSmoothOut, "Smooth Out", icons.SplineSmoothIn64, true));
|
||||
_selectedPointsTabs.SelectedTabIndex = -1;
|
||||
|
||||
layout.Header("All spline points");
|
||||
group = layout.Group("All Points");
|
||||
_allPointsTabs = new Tabs
|
||||
{
|
||||
Height = tabSize,
|
||||
TabsSize = new Float2(tabSize),
|
||||
AutoTabsSize = true,
|
||||
Parent = layout.ContainerControl,
|
||||
Parent = group.ContainerControl,
|
||||
};
|
||||
_setLinearAllTangentsTab = _allPointsTabs.AddTab(new IconTab(OnSetTangentsLinear, "Set Linear Tangents", icons.SplineLinear64));
|
||||
_setSmoothAllTangentsTab = _allPointsTabs.AddTab(new IconTab(OnSetTangentsSmooth, "Set Smooth Tangents", icons.SplineAligned64));
|
||||
|
||||
Reference in New Issue
Block a user