node: send invalidatevisible signal through graph

When dragging a value in the UI, we use a "single frame update" because we want
to prioritize the currently visible frame to give visual feedback as soon as
possible. Previously, we generated a single frame InvalidateCache() signal
from the widgets themselves, but this had the major downside of not necessarily
emitting the time that the viewer was actually showing (due to either node time
transformations or times differing between the effects panels and the viewer
panels). Now, we send a different signal that viewers can handle themselves to
update the time that they're currently showing. This means the fast updating
will work no matter how many viewers are connected at whatever time each viewer
is set to.
This commit is contained in:
itsmattkc
2020-01-26 14:16:22 +11:00
parent ce17d94b12
commit 0469fac4a9
8 changed files with 53 additions and 9 deletions
+12 -8
View File
@@ -124,7 +124,9 @@ void KeyframeViewBase::mouseMoveEvent(QMouseEvent *event)
false);
} else if (!selected_keys_.isEmpty()) {
foreach (const KeyframeItemAndTime& keypair, selected_keys_) {
keypair.key->key()->parent()->blockSignals(true);
NodeInput* input_parent = keypair.key->key()->parent();
input_parent->blockSignals(true);
keypair.key->key()->set_time(CalculateNewTimeFromScreen(keypair.time, mouse_diff_scaled.x()));
@@ -134,9 +136,9 @@ void KeyframeViewBase::mouseMoveEvent(QMouseEvent *event)
// We emit a custom value changed signal while the keyframe is being dragged so only the currently viewed
// frame gets rendered in this time
keypair.key->key()->parent()->blockSignals(false);
input_parent->blockSignals(false);
emit keypair.key->key()->parent()->ValueChanged(GetPlayheadTime(), GetPlayheadTime());
input_parent->parentNode()->InvalidateVisible(input_parent);
}
}
}
@@ -281,13 +283,15 @@ void KeyframeViewBase::ProcessBezierDrag(QPointF mouse_diff_scaled, bool include
new_opposing_pos = dragging_bezier_point_opposing_start_;
}
NodeInput* input_parent = dragging_bezier_point_->key()->parent();
if (undoable) {
QUndoCommand* command = new QUndoCommand();
// Similar to the code in MouseRelease, we manipulated the signalling earlier and need to set the keys back to their
// original position to allow the input to signal correctly when the undo command is pushed.
dragging_bezier_point_->key()->parent()->blockSignals(true);
input_parent->blockSignals(true);
dragging_bezier_point_->key()->set_bezier_control(dragging_bezier_point_->mode(),
dragging_bezier_point_start_);
@@ -309,11 +313,11 @@ void KeyframeViewBase::ProcessBezierDrag(QPointF mouse_diff_scaled, bool include
command);
}
dragging_bezier_point_->key()->parent()->blockSignals(false);
input_parent->blockSignals(false);
Core::instance()->undo_stack()->push(command);
} else {
dragging_bezier_point_->key()->parent()->blockSignals(true);
input_parent->blockSignals(true);
dragging_bezier_point_->key()->set_bezier_control(dragging_bezier_point_->mode(),
new_bezier_pos);
@@ -321,9 +325,9 @@ void KeyframeViewBase::ProcessBezierDrag(QPointF mouse_diff_scaled, bool include
dragging_bezier_point_->key()->set_bezier_control(opposing_type,
new_opposing_pos);
dragging_bezier_point_->key()->parent()->blockSignals(false);
input_parent->blockSignals(false);
emit dragging_bezier_point_->key()->parent()->ValueChanged(GetPlayheadTime(), GetPlayheadTime());
input_parent->parentNode()->InvalidateVisible(input_parent);
}
}