moved track to take an array of blocks rather than a non-directed graph

This commit is contained in:
itsmattkc
2019-12-01 00:03:59 +11:00
parent da680094bf
commit 8b1dab8296
2 changed files with 4 additions and 32 deletions
+3 -26
View File
@@ -26,11 +26,13 @@
#include "node/graph.h"
TrackOutput::TrackOutput() :
current_block_(this),
track_type_(kTrackTypeNone),
block_invalidate_cache_stack_(0),
index_(-1)
{
block_input_ = new NodeInputArray("block_in");
AddParameter(block_input_);
track_input_ = new NodeInput("track_in");
track_input_->set_data_type(NodeParam::kTrack);
track_input_->set_dependent(false);
@@ -99,10 +101,6 @@ void TrackOutput::Refresh()
foreach (Block* b, block_cache_) {
if (!detect_attached_blocks.contains(b)) {
// If the current block was removed, stop referencing it
if (current_block_ == b) {
current_block_ = this;
}
emit BlockRemoved(b);
}
}
@@ -309,27 +307,6 @@ void TrackOutput::AddBlockToGraph(Block *block)
graph->AddNodeWithDependencies(block);
}
void TrackOutput::ValidateCurrentBlock(const rational &time)
{
// This node representso the end of the timeline, so being beyond its in point is considered the end of the sequence
if (time >= in()) {
current_block_ = this;
return;
}
// If we're here, we need to find the current clip to display
// If the time requested is an earlier Block, traverse earlier until we find it
while (time < current_block_->in()) {
current_block_ = current_block_->previous();
}
// If the time requested is in a later Block, traverse later
while (time >= current_block_->out()) {
current_block_ = current_block_->next();
}
}
void TrackOutput::BlockInvalidateCache()
{
block_invalidate_cache_stack_++;
+1 -6
View File
@@ -156,16 +156,11 @@ private:
*/
void RemoveBlockInternal();
/**
* @brief Sets current_block_ to the correct attached Block based on `time`
*/
void ValidateCurrentBlock(const rational& time);
static TrackOutput* TrackFromBlock(Block* block);
QVector<Block*> block_cache_;
Block* current_block_;
NodeInputArray* block_input_;
NodeInput* track_input_;