reworked NodeInput to accept more than one keyframe "track"

To allow keyframing of each axis of a vector 2/3/4, without simply separating
the inputs for each axis, the NodeInputs need to support more than one keyframe
track with the ability to merge them into a single value when necessary.
This commit is contained in:
itsmattkc
2019-12-30 02:12:48 +11:00
parent 994d8be961
commit ae84067084
4 changed files with 159 additions and 63 deletions
+18 -4
View File
@@ -53,14 +53,14 @@ public:
kOutHandle
};
static const Type kDefaultType = kLinear;
/**
* @brief NodeKeyframe Constructor
*/
NodeKeyframe(const rational& time, const QVariant& value, const Type& type);
NodeKeyframe(const rational& time, const QVariant& value, const Type& type, const int& track = 0);
static const Type kDefaultType = kLinear;
static NodeKeyframePtr Create(const rational& time, const QVariant& value, const Type& type);
static NodeKeyframePtr Create(const rational& time, const QVariant& value, const Type& type, const int &track = 0);
NodeKeyframePtr copy() const;
@@ -100,6 +100,17 @@ public:
const QPointF& bezier_control(BezierType type) const;
void set_bezier_control(BezierType type, const QPointF& control);
/**
* @brief The track that this keyframe belongs to
*
* For the majority of keyfreames, this will be 0, but for some types, such as kVec2, this will be 0 for X keyframes
* and 1 for Y keyframes, etc.
*/
const int& track() const;
/**
* @brief Convenience function for getting the opposite handle type (e.g. kInHandle <-> kOutHandle)
*/
static BezierType get_opposing_bezier_type(BezierType type);
signals:
@@ -138,6 +149,9 @@ private:
QPointF bezier_control_in_;
QPointF bezier_control_out_;
int track_;
};
Q_DECLARE_METATYPE(NodeKeyframe::Type)