added base 'block' node
This commit is contained in:
@@ -22,7 +22,17 @@
|
||||
|
||||
Block::Block()
|
||||
{
|
||||
previous_input_ = new NodeInput();
|
||||
AddParameter(previous_input_);
|
||||
|
||||
previous_output_ = new NodeOutput();
|
||||
AddParameter(previous_output_);
|
||||
|
||||
next_input_ = new NodeInput();
|
||||
AddParameter(next_input_);
|
||||
|
||||
next_output_ = new NodeOutput();
|
||||
AddParameter(next_output_);
|
||||
}
|
||||
|
||||
QString Block::Category()
|
||||
@@ -30,7 +40,41 @@ QString Block::Category()
|
||||
return tr("Block");
|
||||
}
|
||||
|
||||
rational Block::in()
|
||||
{
|
||||
rational in_point = 0;
|
||||
|
||||
Block* block = previous();
|
||||
|
||||
while (block != nullptr) {
|
||||
in_point += block->length();
|
||||
|
||||
block = previous();
|
||||
}
|
||||
|
||||
return in_point;
|
||||
}
|
||||
|
||||
rational Block::out()
|
||||
{
|
||||
return in() + length();
|
||||
}
|
||||
|
||||
Block *Block::previous()
|
||||
{
|
||||
return ValueToPtr<Block>(previous_input_->get_value(0));
|
||||
}
|
||||
|
||||
Block *Block::next()
|
||||
{
|
||||
return ValueToPtr<Block>(next_input_->get_value(0));
|
||||
}
|
||||
|
||||
void Block::Process(const rational &time)
|
||||
{
|
||||
Q_UNUSED(time)
|
||||
|
||||
// Simply set both output values as a pointer to this object
|
||||
previous_output_->set_value(PtrToValue(this));
|
||||
next_output_->set_value(PtrToValue(this));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user