Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
CurveEdInterface.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Math/Color.h"
7#include "Math/InterpCurvePoint.h"
8
9/** Interface that allows the CurveEditor to edit this type of object. */
11{
12public:
13 /** Get number of keyframes in curve. */
14 virtual int32 GetNumKeys() const { return 0; }
15
16 /** Get number of 'sub curves' in this Curve. For example, a vector curve will have 3 sub-curves, for X, Y and Z. */
17 virtual int32 GetNumSubCurves() const { return 0; }
18
19 /**
20 * Provides the color for the sub-curve button that is present on the curve tab.
21 *
22 * @param SubCurveIndex The index of the sub-curve. Cannot be negative nor greater or equal to the number of sub-curves.
23 * @param bIsSubCurveHidden Is the curve hidden?
24 * @return The color associated to the given sub-curve index.
25 */
26 virtual FColor GetSubCurveButtonColor(int32 SubCurveIndex, bool bIsSubCurveHidden) const { return bIsSubCurveHidden ? FColor( 32, 0, 0) : FColor(255, 0, 0); }
27
28 /** Get the input value for the Key with the specified index. KeyIndex must be within range ie >=0 and < NumKeys. */
29 virtual float GetKeyIn(int32 KeyIndex) { return 0.f; }
30
31 /**
32 * Get the output value for the key with the specified index on the specified sub-curve.
33 * SubIndex must be within range ie >=0 and < NumSubCurves.
34 * KeyIndex must be within range ie >=0 and < NumKeys.
35 */
36 virtual float GetKeyOut(int32 SubIndex, int32 KeyIndex) { return 0.f; }
37
38 /**
39 * Provides the color for the given key at the given sub-curve.
40 *
41 * @param SubIndex The index of the sub-curve
42 * @param KeyIndex The index of the key in the sub-curve
43 * @param[in] CurveColor The color of the curve
44 * @return The color that is associated the given key at the given sub-curve
45 */
46 virtual FColor GetKeyColor(int32 SubIndex, int32 KeyIndex, const FColor& CurveColor) { return CurveColor; }
47
48 /** Evaluate a subcurve at an arbitary point. Outside the keyframe range, curves are assumed to continue their end values. */
49 virtual float EvalSub(int32 SubIndex, float InVal) { return 0.f; }
50
51 /**
52 * Get the interpolation mode of the specified keyframe. This can be CIM_Constant, CIM_Linear or CIM_Curve.
53 * KeyIndex must be within range ie >=0 and < NumKeys.
54 */
55 virtual EInterpCurveMode GetKeyInterpMode(int32 KeyIndex) const { return CIM_Linear; }
56
57 /**
58 * Get the incoming and outgoing tangent for the given subcurve and key.
59 * SubIndex must be within range ie >=0 and < NumSubCurves.
60 * KeyIndex must be within range ie >=0 and < NumKeys.
61 */
62 virtual void GetTangents(int32 SubIndex, int32 KeyIndex, float& ArriveTangent, float& LeaveTangent) const { ArriveTangent=0.f; LeaveTangent=0.f; }
63
64 /** Get input range of keys. Outside this region curve continues constantly the start/end values. */
65 virtual void GetInRange(float& MinIn, float& MaxIn) const { MinIn=0.f; MaxIn=0.f; }
66
67 /** Get overall range of output values. */
68 virtual void GetOutRange(float& MinOut, float& MaxOut) const { MinOut=0.f; MaxOut=0.f; }
69
70 /**
71 * Add a new key to the curve with the specified input. Its initial value is set using EvalSub at that location.
72 * Returns the index of the new key.
73 */
74 virtual int32 CreateNewKey(float KeyIn) { return INDEX_NONE; }
75
76 /**
77 * Remove the specified key from the curve.
78 * KeyIndex must be within range ie >=0 and < NumKeys.
79 */
80 virtual void DeleteKey(int32 KeyIndex) {}
81
82 /**
83 * Set the input value of the specified Key. This may change the index of the key, so the new index of the key is retured.
84 * KeyIndex must be within range ie >=0 and < NumKeys.
85 */
86 virtual int32 SetKeyIn(int32 KeyIndex, float NewInVal) { return KeyIndex; }
87
88 /**
89 * Set the output values of the specified key.
90 * SubIndex must be within range ie >=0 and < NumSubCurves.
91 * KeyIndex must be within range ie >=0 and < NumKeys.
92 */
93 virtual void SetKeyOut(int32 SubIndex, int32 KeyIndex, float NewOutVal) {}
94
95 /**
96 * Set the method to use for interpolating between the give keyframe and the next one.
97 * KeyIndex must be within range ie >=0 and < NumKeys.
98 */
99 virtual void SetKeyInterpMode(int32 KeyIndex, EInterpCurveMode NewMode) {}
100
101
102 /**
103 * Set the incoming and outgoing tangent for the given subcurve and key.
104 * SubIndex must be within range ie >=0 and < NumSubCurves.
105 * KeyIndex must be within range ie >=0 and < NumKeys.
106 */
107 virtual void SetTangents(int32 SubIndex, int32 KeyIndex, float ArriveTangent, float LeaveTangent) {}
108};
@ INDEX_NONE
EInterpCurveMode
Definition Enums.h:6108
@ CIM_Linear
virtual EInterpCurveMode GetKeyInterpMode(int32 KeyIndex) const
virtual void SetTangents(int32 SubIndex, int32 KeyIndex, float ArriveTangent, float LeaveTangent)
virtual FColor GetKeyColor(int32 SubIndex, int32 KeyIndex, const FColor &CurveColor)
virtual int32 CreateNewKey(float KeyIn)
virtual int32 GetNumKeys() const
virtual float EvalSub(int32 SubIndex, float InVal)
virtual float GetKeyOut(int32 SubIndex, int32 KeyIndex)
virtual void SetKeyInterpMode(int32 KeyIndex, EInterpCurveMode NewMode)
virtual void SetKeyOut(int32 SubIndex, int32 KeyIndex, float NewOutVal)
virtual float GetKeyIn(int32 KeyIndex)
virtual int32 GetNumSubCurves() const
virtual void GetInRange(float &MinIn, float &MaxIn) const
virtual int32 SetKeyIn(int32 KeyIndex, float NewInVal)
virtual void DeleteKey(int32 KeyIndex)
virtual void GetOutRange(float &MinOut, float &MaxOut) const
virtual void GetTangents(int32 SubIndex, int32 KeyIndex, float &ArriveTangent, float &LeaveTangent) const
virtual FColor GetSubCurveButtonColor(int32 SubCurveIndex, bool bIsSubCurveHidden) const
constexpr FORCEINLINE FColor(uint8 InR, uint8 InG, uint8 InB, uint8 InA=255)
Definition Color.h:566