removed "previous_input" param from block

It was becoming inevitable to get rid of this, it was continuously an exception
that had to be made to the DAG concept seeing as blocks are never really
"dependents" on each other, i.e. the images they produce have nothing to do
with other blocks. The only exception is a transition which will also be
easier to accomplish with this slightly different design.
This commit is contained in:
itsmattkc
2019-11-30 23:24:01 +11:00
parent 7c5b50c5e7
commit a478b11fd0
3 changed files with 10 additions and 53 deletions
+6 -40
View File
@@ -23,13 +23,9 @@
#include <QDebug>
Block::Block() :
previous_(nullptr),
next_(nullptr)
{
previous_input_ = new NodeInput("prev_in");
previous_input_->set_data_type(NodeParam::kBlock);
previous_input_->set_dependent(false);
AddParameter(previous_input_);
block_output_ = new NodeOutput("this_out");
AddParameter(block_output_);
@@ -84,7 +80,7 @@ void Block::set_length_and_media_in(const rational &length)
Block *Block::previous()
{
return ValueToPtr<Block>(previous_input_->get_realtime_value_of_connected_output());
return previous_;
}
Block *Block::next()
@@ -92,11 +88,6 @@ Block *Block::next()
return next_;
}
NodeInput *Block::previous_input()
{
return previous_input_;
}
QVariant Block::Value(NodeOutput *output)
{
if (output == block_output_) {
@@ -107,31 +98,6 @@ QVariant Block::Value(NodeOutput *output)
return 0;
}
void Block::EdgeAddedSlot(NodeEdgePtr edge)
{
if (edge->input() == previous_input()) {
// FIXME: No protection for if this connection is not a block
static_cast<Block*>(edge->output()->parent())->next_ = this;
// The blocks surrounding this one have changed, we need to Refresh()
Refresh();
// Entire track will have shifted, so the whole cache needs to be re-validated
SendInvalidateCache(0, RATIONAL_MAX);
}
}
void Block::EdgeRemovedSlot(NodeEdgePtr edge)
{
if (edge->input() == previous_input()) {
// FIXME: No protection for if this connection is not a block
static_cast<Block*>(edge->output()->parent())->next_ = nullptr;
// The blocks surrounding this one have changed, we need to Refresh()
Refresh();
}
}
void Block::Refresh()
{
// Set in point to the out point of the previous Node
@@ -161,14 +127,14 @@ NodeOutput *Block::block_output()
return block_output_;
}
void Block::ConnectBlocks(Block *previous, Block *next)
void Block::ConnectBlocks(Block *, Block *)
{
NodeParam::ConnectEdge(previous->block_output(), next->previous_input());
//NodeParam::ConnectEdge(previous->block_output(), next->previous_input());
}
void Block::DisconnectBlocks(Block *previous, Block *next)
void Block::DisconnectBlocks(Block *, Block *)
{
NodeParam::DisconnectEdge(previous->block_output(), next->previous_input());
//NodeParam::DisconnectEdge(previous->block_output(), next->previous_input());
}
const rational &Block::media_in()
+1 -10
View File
@@ -59,8 +59,6 @@ public:
Block* previous();
Block* next();
NodeInput* previous_input();
NodeOutput* buffer_output();
NodeOutput* block_output();
@@ -116,29 +114,22 @@ protected:
static void CopyParameters(Block* source, Block* dest);
private:
NodeInput* previous_input_;
NodeOutput* block_output_;
NodeOutput* buffer_output_;
rational in_point_;
rational out_point_;
rational length_;
rational media_in_;
Block* previous_;
Block* next_;
QString block_name_;
QVector<Block*> linked_clips_;
private slots:
void EdgeAddedSlot(NodeEdgePtr edge);
void EdgeRemovedSlot(NodeEdgePtr edge);
};
#endif // BLOCK_H
+3 -3
View File
@@ -181,12 +181,12 @@ const QVector<Block *> &TrackOutput::Blocks()
void TrackOutput::InvalidateCache(const rational &start_range, const rational &end_range, NodeInput *from)
{
// We intercept IC signals from Blocks since we may be performing several options and they may over-signal
/*// We intercept IC signals from Blocks since we may be performing several options and they may over-signal
if (from == previous_input() && block_invalidate_cache_stack_ == 0) {
Node::InvalidateCache(qMax(start_range, rational(0)), qMin(end_range, in()), from);
} else {
Node::InvalidateCache(start_range, end_range, from);
}
}*/
Node::InvalidateCache(start_range, end_range, from);
}
QVariant TrackOutput::Value(NodeOutput *output)