multicam: allow overrides by selecting multicam nodes in nodeview

This commit is contained in:
itsmattkc
2022-10-02 11:23:55 -07:00
parent 2aaf96d55b
commit 8a2f2912b4
4 changed files with 46 additions and 6 deletions
+5
View File
@@ -77,6 +77,11 @@ public:
GetViewerWidget()->SetTimelineSelectedBlocks(b);
}
void SetNodeViewSelections(const QVector<Node*> &n)
{
GetViewerWidget()->SetNodeViewSelections(n);
}
void ConnectMulticamWidget(MulticamWidget *p)
{
GetViewerWidget()->ConnectMulticamWidget(p);
+27 -6
View File
@@ -260,6 +260,9 @@ void ViewerWidget::DisconnectNodeEvent(ViewerOutput *n)
disconnect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
disconnect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateWaveformViewFromMode);
timeline_selected_blocks_.clear();
node_view_selected_.clear();
CloseAudioProcessor();
audio_scrub_watchers_.clear();
@@ -621,12 +624,30 @@ void ViewerWidget::DetectMulticamNode(const rational &time)
// Faster way to do this
if (multicam_panel_ && multicam_panel_->isVisible()) {
if (Sequence *s = dynamic_cast<Sequence*>(GetConnectedNode())) {
// Prefer selected blocks
for (Block *b : timeline_selected_blocks_) {
if (b->range().Contains(time)) {
if ((clip = dynamic_cast<ClipBlock*>(b))) {
if ((multicam = clip->FindMulticam())) {
break;
// Prefer selected nodes
for (Node *n : qAsConst(node_view_selected_)) {
if ((multicam = dynamic_cast<MultiCamNode*>(n))) {
// Found multicam, now try to find corresponding clip from selected timeline blocks
for (Block *b : qAsConst(timeline_selected_blocks_)) {
if (ClipBlock *c = dynamic_cast<ClipBlock*>(b)) {
if (c->range().Contains(time) && c->ContextContainsNode(multicam)) {
clip = c;
break;
}
}
}
break;
}
}
// Next, prefer multicam from selected block
if (!multicam) {
for (Block *b : qAsConst(timeline_selected_blocks_)) {
if (b->range().Contains(time)) {
if ((clip = dynamic_cast<ClipBlock*>(b))) {
if ((multicam = clip->FindMulticam())) {
break;
}
}
}
}
+12
View File
@@ -122,6 +122,17 @@ public:
}
}
void SetNodeViewSelections(const QVector<Node*> &n)
{
node_view_selected_ = n;
if (!IsPlaying()) {
// If is playing, this will happen by the next frame automatically
DetectMulticamNode(GetTime());
UpdateTextureFromNode();
}
}
void ConnectMulticamWidget(MulticamWidget *p);
public slots:
@@ -340,6 +351,7 @@ private:
int ignore_scrub_;
QVector<Block*> timeline_selected_blocks_;
QVector<Node*> node_view_selected_;
MulticamWidget *multicam_panel_;
+2
View File
@@ -105,6 +105,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(param_panel_, &ParamPanel::FocusedNodeChanged, curve_panel_, &CurvePanel::SetNode);
connect(param_panel_, &ParamPanel::SelectedNodesChanged, node_panel_, &NodePanel::Select);
connect(node_panel_, &NodePanel::NodeSelectionChanged, sequence_viewer_panel_, &ViewerPanel::SetNodeViewSelections);
// Connect time signals together
AddMainTimePanel(multicam_panel_);
AddMainTimePanel(curve_panel_);