track enhancements

This commit is contained in:
itsmattkc
2019-09-13 02:47:09 +10:00
parent e985e31937
commit 5ab622ba81
3 changed files with 25 additions and 16 deletions
+15 -1
View File
@@ -22,6 +22,7 @@
#include <QDebug>
#include "node/blend/alphaover/alphaover.h"
#include "node/block/gap/gap.h"
#include "node/graph.h"
@@ -199,9 +200,22 @@ void TimelineOutput::AddTrack()
static_cast<NodeGraph*>(parent())->AddNode(track);
if (track_cache_.isEmpty()) {
// Connect this track directly to this output
NodeParam::ConnectEdge(track->track_output(), track_input());
} else {
NodeParam::ConnectEdge(track->track_output(), track_cache_.last()->track_input());
TrackOutput* current_last_track = track_cache_.last();
// Connect this track to the current last track
NodeParam::ConnectEdge(track->track_output(), current_last_track->track_input());
// FIXME: Test code only
AlphaOverBlend* blend = new AlphaOverBlend();
static_cast<NodeGraph*>(parent())->AddNode(blend);
NodeParam::ConnectEdge(track->texture_output(), blend->blend_input());
NodeParam::ConnectEdge(current_last_track->texture_output(), blend->base_input());
NodeParam::ConnectEdge(blend->texture_output(), current_last_track->texture_output()->edges().first()->input());
// End test code
}
}
+10 -13
View File
@@ -79,15 +79,15 @@ void TrackOutput::Refresh()
{
QVector<Block*> detect_attached_blocks;
Block* previous = attached_block();
while (previous != nullptr) {
detect_attached_blocks.prepend(previous);
Block* prev = previous();
while (prev != nullptr) {
detect_attached_blocks.prepend(prev);
if (!block_cache_.contains(previous)) {
emit BlockAdded(previous);
if (!block_cache_.contains(prev)) {
emit BlockAdded(prev);
}
previous = previous->previous();
prev = prev->previous();
}
foreach (Block* b, block_cache_) {
@@ -104,7 +104,7 @@ void TrackOutput::Refresh()
block_cache_ = detect_attached_blocks;
Block::Refresh();
qDebug() << "Refreshed with in point" << in().toDouble() << "(from connected block" << previous << ")";
qDebug() << "Refreshed with in point" << in().toDouble() << "(from connected block" << previous() << ")";
}
QList<NodeDependency> TrackOutput::RunDependencies(NodeOutput* output, const rational &time)
@@ -154,11 +154,13 @@ NodeOutput* TrackOutput::track_output()
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
if (block_invalidate_cache_stack_ == 0) {
if (from == previous_input() && block_invalidate_cache_stack_ == 0) {
qDebug() << "Received IC Signal:" << start_range.toDouble() << "to" << end_range.toDouble();
qDebug() << "Limiting IC Signal To:" << qMax(start_range, rational(0)).toDouble() << "to" << qMin(end_range, in()).toDouble();
Node::InvalidateCache(qMax(start_range, rational(0)), qMin(end_range, in()), from);
} else {
Node::InvalidateCache(start_range, end_range, from);
}
}
@@ -212,11 +214,6 @@ void TrackOutput::InsertBlockAfter(Block *block, Block *before)
InsertBlockBetweenBlocks(block, before, before->next());
}
Block *TrackOutput::attached_block()
{
return ValueToPtr<Block>(previous_input()->get_value(0));
}
void TrackOutput::PrependBlock(Block *block)
{
AddBlockToGraph(block);
-2
View File
@@ -191,8 +191,6 @@ private:
void BlockInvalidateCache();
void UnblockInvalidateCache();
Block* attached_block();
QVector<Block*> block_cache_;
Block* current_block_;