implemented bezier interpolation into parameters inputs

This commit is contained in:
itsmattkc
2019-12-28 23:21:07 +11:00
parent 1d3d52db9b
commit 994d8be961
9 changed files with 157 additions and 11 deletions
@@ -74,7 +74,9 @@ void BezierControlPointItem::UpdatePos()
// Scale handle offset
handle_offset.setX(handle_offset.x() * x_scale_);
handle_offset.setY(handle_offset.y() * y_scale_);
// Flip the Y coordinate because bezier curves are drawn bottom to top
handle_offset.setY(-handle_offset.y() * y_scale_);
setPos(handle_offset - rect().center());
}
+2 -1
View File
@@ -236,7 +236,8 @@ void CurveView::SetItemYFromKeyframeValue(NodeKeyframe *key, KeyframeViewItem *i
QPointF CurveView::ScalePoint(const QPointF &point)
{
return QPointF(point.x() * scale_, point.y() * y_scale_);
// Flips Y coordinate because curves are drawn bottom to top
return QPointF(point.x() * scale_, - point.y() * y_scale_);
}
void CurveView::KeyframeValueChanged()
+4 -3
View File
@@ -54,8 +54,6 @@ void KeyframeViewBase::mousePressEvent(QMouseEvent *event)
active_tool_ = Core::instance()->tool();
rubberBandSelectionMode();
if (event->button() == Qt::LeftButton) {
QGraphicsView::mousePressEvent(event);
@@ -203,8 +201,11 @@ QPointF KeyframeViewBase::GenerateBezierControlPosition(const NodeKeyframe::Bezi
return new_bezier_pos;
}
void KeyframeViewBase::ProcessBezierDrag(const QPointF& mouse_diff_scaled, bool include_opposing, bool undoable)
void KeyframeViewBase::ProcessBezierDrag(QPointF mouse_diff_scaled, bool include_opposing, bool undoable)
{
// Flip the mouse Y because bezier control points are drawn bottom to top, not top to bottom
mouse_diff_scaled.setY(-mouse_diff_scaled.y());
QPointF new_bezier_pos = GenerateBezierControlPosition(dragging_bezier_point_->mode(),
dragging_bezier_point_start_,
mouse_diff_scaled);
+1 -1
View File
@@ -38,7 +38,7 @@ private:
const QPointF& start_point,
const QPointF& scaled_cursor_diff);
void ProcessBezierDrag(const QPointF& mouse_diff_scaled, bool include_opposing, bool undoable);
void ProcessBezierDrag(QPointF mouse_diff_scaled, bool include_opposing, bool undoable);
QPointF GetScaledCursorPos(const QPoint& cursor_pos);