nodes: moved matrix input on "video input" elsewhere

Rather than plugging a matrix into the video input node, the matrix is now
multiplied by the video input using a math node. This is probably more
sensible from a user perspective.

This also means the renderer is tolerant of texture sizes that are not equal
to the sequence size, however most nodes will downsample the texture to the
sequence size (and if not, it will be downsampled once it is cached). Textures
will still *always* be in reference space and the sequence's format. This seems
like the best compromise between backend and frontend congruity.
This commit is contained in:
itsmattkc
2020-04-27 04:11:24 +10:00
parent f61321d68b
commit ac3f49a845
26 changed files with 307 additions and 358 deletions
@@ -42,6 +42,8 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(NodeInput *input, QWidg
connect(connected_to_lbl_, &ClickableLabel::MouseClicked, this, &NodeParamViewConnectedLabel::ConnectionClicked);
layout->addWidget(connected_to_lbl_);
layout->addStretch();
// Set up "link" font
QFont link_font = connected_to_lbl_->font();
link_font.setUnderline(true);
+11 -8
View File
@@ -30,9 +30,10 @@
#include "core.h"
#include "dialog/sequence/sequence.h"
#include "node/audio/volume/volume.h"
#include "node/distort/transform/transform.h"
#include "node/generator/matrix/matrix.h"
#include "node/input/media/audio/audio.h"
#include "node/input/media/video/video.h"
#include "node/math/math/math.h"
#include "project/item/sequence/sequence.h"
#include "widget/nodeview/nodeviewundo.h"
#include "window/mainwindow/mainwindow.h"
@@ -397,15 +398,17 @@ void TimelineWidget::ImportTool::DropGhosts(bool insert)
VideoInput* video_input = new VideoInput();
video_input->SetFootage(footage_stream);
new NodeAddCommand(dst_graph, video_input, command);
new NodeEdgeAddCommand(video_input->output(), clip->texture_input(), command);
TransformDistort* transform = new TransformDistort();
new NodeAddCommand(dst_graph, transform, command);
new NodeEdgeAddCommand(transform->output(), video_input->matrix_input(), command);
MatrixGenerator* matrix = new MatrixGenerator();
new NodeAddCommand(dst_graph, matrix, command);
//OpacityNode* opacity = new OpacityNode();
//NodeParam::ConnectEdge(opacity->texture_output(), clip->texture_input());
//NodeParam::ConnectEdge(media->texture_output(), opacity->texture_input());
MathNode* multiply = new MathNode();
multiply->SetOperation(MathNode::kOpMultiply);
new NodeAddCommand(dst_graph, multiply, command);
new NodeEdgeAddCommand(video_input->output(), multiply->param_a_in(), command);
new NodeEdgeAddCommand(matrix->output(), multiply->param_b_in(), command);
new NodeEdgeAddCommand(multiply->output(), clip->texture_input(), command);
break;
}
case Stream::kAudio:
+24 -26
View File
@@ -613,33 +613,31 @@ void TrackCleanGapsCommand::redo_internal()
TrackOutput* track = track_list_->GetTrackAt(track_index_);
foreach (Block* b, track->Blocks()) {
if (b) {
if (b->type() == Block::kGap) {
if (on_gap) {
consecutive_gaps.append(static_cast<GapBlock*>(b));
} else {
on_gap = static_cast<GapBlock*>(b);
}
} else if (on_gap) {
merged_gaps_.append({on_gap, on_gap->length(), consecutive_gaps});
// Remove each gap and add to the length of the merged
// We can block the IC signal because merging gaps won't actually change anything
track->BlockInvalidateCache();
rational new_gap_length = on_gap->length();
foreach (GapBlock* gap, consecutive_gaps) {
track->RippleRemoveBlock(gap);
static_cast<NodeGraph*>(track->parent())->TakeNode(gap, &memory_manager_);
new_gap_length += gap->length();
}
on_gap->set_length_and_media_out(new_gap_length);
track->UnblockInvalidateCache();
// Reset state
on_gap = nullptr;
consecutive_gaps.clear();
if (b->type() == Block::kGap) {
if (on_gap) {
consecutive_gaps.append(static_cast<GapBlock*>(b));
} else {
on_gap = static_cast<GapBlock*>(b);
}
} else if (on_gap) {
merged_gaps_.append({on_gap, on_gap->length(), consecutive_gaps});
// Remove each gap and add to the length of the merged
// We can block the IC signal because merging gaps won't actually change anything
track->BlockInvalidateCache();
rational new_gap_length = on_gap->length();
foreach (GapBlock* gap, consecutive_gaps) {
track->RippleRemoveBlock(gap);
static_cast<NodeGraph*>(track->parent())->TakeNode(gap, &memory_manager_);
new_gap_length += gap->length();
}
on_gap->set_length_and_media_out(new_gap_length);
track->UnblockInvalidateCache();
// Reset state
on_gap = nullptr;
consecutive_gaps.clear();
}
}
@@ -134,7 +134,11 @@ void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsI
} else {
painter->setPen(Qt::lightGray);
}
painter->drawText(rect(), static_cast<int>(Qt::AlignLeft | Qt::AlignTop), block_->block_name());
int text_top = TrackOutput::GetTrackHeightMinimum() / 2 - painter->fontMetrics().height() / 2;
QRectF text_rect = rect();
text_rect.adjust(0, text_top, 0, 0);
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop, block_->block_name());
// Linked clips are underlined
if (block_->HasLinks()) {