several adjustments to node caching system
This commit is contained in:
@@ -175,6 +175,21 @@ void TrackOutput::InsertBlockBetweenBlocks(Block *block, Block *before, Block *a
|
||||
Block::ConnectBlocks(block, after);
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockBefore(Block* block, Block* after)
|
||||
{
|
||||
Block* before = after->previous();
|
||||
|
||||
// If a block precedes this one, just insert between them
|
||||
if (before != nullptr) {
|
||||
InsertBlockBetweenBlocks(block, before, after);
|
||||
} else {
|
||||
AddBlockToGraph(block);
|
||||
|
||||
// Otherwise, just connect the block since there's no before clip to insert between
|
||||
Block::ConnectBlocks(block, after);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
{
|
||||
InsertBlockBetweenBlocks(block, before, before->next());
|
||||
@@ -279,16 +294,20 @@ void TrackOutput::PlaceBlock(Block *block, rational start)
|
||||
|
||||
// Check if the placement location is past the end of the timeline
|
||||
if (start >= in()) {
|
||||
GapBlock* gap = nullptr;
|
||||
|
||||
if (start > in()) {
|
||||
// If so, insert a gap here
|
||||
GapBlock* gap = new GapBlock();
|
||||
gap = new GapBlock();
|
||||
gap->set_length(start - in());
|
||||
|
||||
// Then append them
|
||||
AppendBlock(gap);
|
||||
}
|
||||
|
||||
AppendBlock(block);
|
||||
InsertBlockBefore(block, this);
|
||||
|
||||
if (gap != nullptr) {
|
||||
// Insert gap if we made one before
|
||||
InsertBlockBefore(gap, block);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,11 @@ public:
|
||||
*/
|
||||
void InsertBlockAfter(Block* block, Block* before);
|
||||
|
||||
/**
|
||||
* @brief Inserts Block before another Block
|
||||
*/
|
||||
void InsertBlockBefore(Block* block, Block* after);
|
||||
|
||||
/**
|
||||
* @brief Adds Block `block` at the very end of the Sequence after all other clips
|
||||
*/
|
||||
|
||||
@@ -78,12 +78,12 @@ void ViewerOutput::AttachViewer(ViewerPanel *viewer)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateCache(const rational &start_range, const rational &end_range)
|
||||
void ViewerOutput::InvalidateCache(NodeInput* from, const rational &start_range, const rational &end_range)
|
||||
{
|
||||
// Update any attached viewer
|
||||
UpdateViewer();
|
||||
|
||||
Node::InvalidateCache(start_range, end_range);
|
||||
Node::InvalidateCache(from, start_range, end_range);
|
||||
}
|
||||
|
||||
void ViewerOutput::UpdateViewer()
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
void AttachViewer(ViewerPanel* viewer);
|
||||
|
||||
virtual void InvalidateCache(const rational &start_range, const rational &end_range) override;
|
||||
virtual void InvalidateCache(NodeInput* from, const rational &start_range, const rational &end_range) override;
|
||||
|
||||
protected:
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
Reference in New Issue
Block a user