Class CurveEditor<T>
The generic curve editor control.
Inheritance
Implements
Namespace: FlaxEditor.GUI
Assembly: FlaxEngine.CSharp.dll
Syntax
public abstract class CurveEditor<T> : CurveEditorBase, IComparable, IDrawable, IKeyframesEditor where T : new()
Type Parameters
T
The keyframe value type. |
Constructors
CurveEditor()
Fields
_contents
The curve contents area.
Declaration
protected CurveEditor<T>.ContentsBase _contents
Field Value
CurveEditor.ContentsBase<>
|
_mainPanel
_points
The keyframe UI points.
Declaration
protected readonly List<CurveEditor<T>.KeyframePoint> _points
Field Value
System.Collections.Generic.List<CurveEditor.KeyframePoint<>>
|
_refreshAfterEdit
True if refresh keyframes positioning before drawing.
Declaration
protected bool _refreshAfterEdit
Field Value
System.Boolean
|
_showCollapsed
True if curve is collapsed.
Declaration
protected bool _showCollapsed
Field Value
System.Boolean
|
_tangents
The tangents UI points.
Declaration
protected readonly CurveEditor<T>.TangentPoint[] _tangents
Field Value
CurveEditor.TangentPoint<>[]
|
Accessor
The keyframes data accessor.
Declaration
public readonly CurveEditor<T>.IKeyframeAccess<T> Accessor
Field Value
CurveEditor.IKeyframeAccess<T>
|
Colors
DefaultValue
The default value.
Declaration
public T DefaultValue
Field Value
T
|
KeyframesSize
LabelsSize
The timeline intervals metric area size (in pixels).
Declaration
protected static readonly float LabelsSize
Field Value
System.Single
|
TickSteps
The curve time/value axes tick steps.
Declaration
protected float[] TickSteps
Field Value
System.Single[]
|
UnitsPerSecond
The timeline units per second (on time axis).
Declaration
public static readonly float UnitsPerSecond
Field Value
System.Single
|
Properties
FPS
Declaration
public override Nullable<float> FPS { get; set; }
Property Value
System.Nullable<System.Single>
|
Overrides
IsUserEditing
Gets a value indicating whether user is editing the curve.
Declaration
public bool IsUserEditing { get; }
Property Value
System.Boolean
|
ScrollBars
Declaration
public override ScrollBars ScrollBars { get; set; }
Property Value
ScrollBars
|
Overrides
ShowCollapsed
Declaration
public override bool ShowCollapsed { get; set; }
Property Value
System.Boolean
|
Overrides
ValueType
Declaration
public override Type ValueType { get; }
Property Value
System.Type
|
Overrides
ViewOffset
Declaration
public override Float2 ViewOffset { get; set; }
Property Value
Float2
|
Overrides
ViewScale
Declaration
public override Float2 ViewScale { get; set; }
Property Value
Float2
|
Overrides
Methods
AddKeyframe(Float2)
Adds a new keyframe at the given location (in keyframes space).
Declaration
protected abstract void AddKeyframe(Float2 keyframesPos)
Parameters
Float2
keyframesPos
The new keyframe position (in keyframes space). |
ClearSelection()
Declaration
public override void ClearSelection()
Overrides
DeselectAll()
Deselects all keyframes.
Declaration
public void DeselectAll()
Draw()
Draw the control and the children.
Declaration
public override void Draw()
Overrides
DrawCurve(ref Rectangle)
Draws the curve.
Declaration
protected abstract void DrawCurve(ref Rectangle viewRect)
Parameters
Rectangle
viewRect
The main panel client area used as a view bounds. |
Evaluate(out T, Single, Boolean)
Evaluates the animation curve value at the specified time.
Declaration
public abstract void Evaluate(out T result, float time, bool loop = false)
Parameters
T
result
The interpolated value from the curve at provided time. |
System.Single
time
The time to evaluate the curve at. |
System.Boolean
loop
If true the curve will loop when it goes past the end or beginning. Otherwise the curve value will be clamped. |
Evaluate(out Object, Single, Boolean)
Declaration
public override void Evaluate(out object result, float time, bool loop = false)
Parameters
System.Object
result
|
System.Single
time
|
System.Boolean
loop
|
Overrides
GetAllKeyframesEditingProxy()
Gets proxy object for all keyframes list.
Declaration
protected abstract CurveEditor<T>.IAllKeyframesProxy GetAllKeyframesEditingProxy()
Returns
CurveEditor.IAllKeyframesProxy<>
The proxy object. |
GetKeyframeTangentInternal(Int32, Boolean, Int32)
Gets the keyframe tangent value (internally).
Declaration
protected abstract float GetKeyframeTangentInternal(int index, bool isIn, int component)
Parameters
System.Int32
index
The keyframe index. |
System.Boolean
isIn
True if tangent is |
System.Int32
component
The value component index. |
Returns
System.Single
The tangent component value. |
GetKeyframeTime(Int32)
Gets the time of the keyframe.
Declaration
protected abstract float GetKeyframeTime(int index)
Parameters
System.Int32
index
The keyframe index. |
Returns
System.Single
The keyframe time. |
GetKeyframeTime(Object)
Gets the time of the keyframe.
Declaration
protected abstract float GetKeyframeTime(object keyframe)
Parameters
System.Object
keyframe
The keyframe object. |
Returns
System.Single
The keyframe time. |
GetKeyframeValue(Object)
Gets the value of the keyframe.
Declaration
protected abstract T GetKeyframeValue(object keyframe)
Parameters
System.Object
keyframe
The keyframe object. |
Returns
T
The keyframe value. |
GetKeyframeValue(Object, Int32)
Gets the value of the keyframe (single component).
Declaration
protected abstract float GetKeyframeValue(object keyframe, int component)
Parameters
System.Object
keyframe
The keyframe object. |
System.Int32
component
The keyframe value component index. |
Returns
System.Single
The keyframe component value. |
OnDestroy()
Method called when managed instance should be destroyed
Declaration
public override void OnDestroy()
Overrides
OnKeyDown(KeyboardKeys)
When key goes down
Declaration
public override bool OnKeyDown(KeyboardKeys key)
Parameters
KeyboardKeys
key
Key value |
Returns
System.Boolean
True if event has been handled, otherwise false |
Overrides
OnKeyframesChanged()
Called when keyframes collection gets changed (keyframe added or removed).
Declaration
protected virtual void OnKeyframesChanged()
OnKeyframesCopy(IKeyframesEditor, Nullable<Single>, StringBuilder)
Declaration
public override void OnKeyframesCopy(IKeyframesEditor editor, Nullable<float> timeOffset, StringBuilder data)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
System.Nullable<System.Single>
timeOffset
|
System.Text.StringBuilder
data
|
Overrides
OnKeyframesDelete(IKeyframesEditor)
Declaration
public override void OnKeyframesDelete(IKeyframesEditor editor)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
Overrides
OnKeyframesDeselect(IKeyframesEditor)
Declaration
public override void OnKeyframesDeselect(IKeyframesEditor editor)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
Overrides
OnKeyframesMove(IKeyframesEditor, ContainerControl, Float2, Boolean, Boolean)
Declaration
public override void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Float2 location, bool start, bool end)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
ContainerControl
control
|
Float2
location
|
System.Boolean
start
|
System.Boolean
end
|
Overrides
OnKeyframesPaste(IKeyframesEditor, Nullable<Single>, String[], ref Int32)
Declaration
public override void OnKeyframesPaste(IKeyframesEditor editor, Nullable<float> timeOffset, string[] datas, ref int index)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
System.Nullable<System.Single>
timeOffset
|
System.String[]
datas
|
System.Int32
index
|
Overrides
OnKeyframesSelection(IKeyframesEditor, ContainerControl, Rectangle)
Declaration
public override void OnKeyframesSelection(IKeyframesEditor editor, ContainerControl control, Rectangle selection)
Parameters
FlaxEditor.GUI.IKeyframesEditor
editor
|
ContainerControl
control
|
Rectangle
selection
|
Overrides
OnKeyframesSelectionCount()
Declaration
public override int OnKeyframesSelectionCount()
Returns
System.Int32
|
Overrides
OnShowContextMenu(ContextMenu, Int32)
Called when showing a context menu. Can be used to add custom buttons with actions.
Declaration
protected virtual void OnShowContextMenu(ContextMenu cm, int selectionCount)
Parameters
FlaxEditor.GUI.ContextMenu.ContextMenu
cm
The menu. |
System.Int32
selectionCount
The amount of selected keyframes. |
OnSizeChanged()
Called when control size gets changed.
Declaration
protected override void OnSizeChanged()
Overrides
PointFromKeyframes(Float2, ref Rectangle)
Converts the input point from the keyframes time/value coordinates into the curve editor control space.
Declaration
protected Float2 PointFromKeyframes(Float2 point, ref Rectangle curveContentAreaBounds)
Parameters
Float2
point
The point. |
Rectangle
curveContentAreaBounds
The curve contents area bounds. |
Returns
Float2
The result. |
PointToKeyframes(Float2, ref Rectangle)
Converts the input point from curve editor control space into the keyframes time/value coordinates.
Declaration
protected Float2 PointToKeyframes(Float2 point, ref Rectangle curveContentAreaBounds)
Parameters
Float2
point
The point. |
Rectangle
curveContentAreaBounds
The curve contents area bounds. |
Returns
Float2
The result. |
RemoveKeyframesInternal(HashSet<Int32>)
Removes the keyframes data (internally).
Declaration
protected abstract void RemoveKeyframesInternal(HashSet<int> indicesToRemove)
Parameters
System.Collections.Generic.HashSet<System.Int32>
indicesToRemove
The list of indices of the keyframes to remove. |
SelectAll()
Selects all keyframes.
Declaration
public void SelectAll()
SetKeyframeInternal(Int32, Object)
Sets the keyframe data (internally).
Declaration
protected abstract void SetKeyframeInternal(int index, object keyframe)
Parameters
System.Int32
index
The keyframe index. |
System.Object
keyframe
The keyframe to set. |
SetKeyframeInternal(Int32, Single, Single, Int32)
Sets the keyframe data (internally).
Declaration
protected abstract void SetKeyframeInternal(int index, float time, float value, int component)
Parameters
System.Int32
index
The keyframe index. |
System.Single
time
The time to set. |
System.Single
value
The value to set. |
System.Int32
component
The value component. |
SetKeyframeTangentInternal(Int32, Boolean, Int32, Single)
Sets the keyframe tangent value (internally).
Declaration
protected abstract void SetKeyframeTangentInternal(int index, bool isIn, int component, float value)
Parameters
System.Int32
index
The keyframe index. |
System.Boolean
isIn
True if tangent is |
System.Int32
component
The value component index. |
System.Single
value
The tangent component value. |
ShowWholeCurve()
Declaration
public override void ShowWholeCurve()
Overrides
UpdateFPS()
Updates the keyframes to match the FPS.
Declaration
protected abstract void UpdateFPS()
UpdateTooltips()
Updates the keyframes tooltips.
Declaration
protected void UpdateTooltips()
Events
KeyframesChanged
Occurs when keyframes collection gets changed (keyframe added or removed).
Declaration
public event Action KeyframesChanged
Event Type
System.Action
|