shifted to new dependency structure
This commit is contained in:
@@ -96,8 +96,12 @@ NodeInput *TimelineOutput::track_input()
|
||||
return track_input_;
|
||||
}
|
||||
|
||||
void TimelineOutput::Process()
|
||||
QVariant TimelineOutput::Value(NodeOutput *output, const rational &time)
|
||||
{
|
||||
Q_UNUSED(output)
|
||||
Q_UNUSED(time)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TimelineOutput::GetTrackIndex(TrackOutput *track)
|
||||
@@ -118,7 +122,7 @@ rational TimelineOutput::GetSequenceLength()
|
||||
|
||||
TrackOutput *TimelineOutput::attached_track()
|
||||
{
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value());
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value(0));
|
||||
}
|
||||
|
||||
void TimelineOutput::AttachTrack(TrackOutput *track)
|
||||
@@ -201,7 +205,7 @@ void TimelineOutput::TrackConnectionRemoved(NodeEdgePtr edge)
|
||||
return;
|
||||
}
|
||||
|
||||
DetachTrack(ValueToPtr<TrackOutput>(edge->output()->get_value()));
|
||||
DetachTrack(ValueToPtr<TrackOutput>(edge->output()->get_value(0)));
|
||||
|
||||
if (attached_timeline_ != nullptr) {
|
||||
attached_timeline_->Clear();
|
||||
@@ -229,7 +233,7 @@ void TimelineOutput::TrackEdgeAdded(NodeEdgePtr edge)
|
||||
|
||||
// If this edge pertains to the track's track input, all the tracks just added need attaching
|
||||
if (edge->input() == track->track_input()) {
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value());
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value(0));
|
||||
|
||||
AttachTrack(added_track);
|
||||
}
|
||||
@@ -242,7 +246,7 @@ void TimelineOutput::TrackEdgeRemoved(NodeEdgePtr edge)
|
||||
|
||||
// If this edge pertains to the track's track input, all the tracks just added need attaching
|
||||
if (edge->input() == track->track_input()) {
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value());
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value(0));
|
||||
|
||||
DetachTrack(added_track);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
NodeInput* track_input();
|
||||
|
||||
protected:
|
||||
virtual void Process() override;
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
private:
|
||||
int GetTrackIndex(TrackOutput* track);
|
||||
|
||||
@@ -99,22 +99,19 @@ void TrackOutput::Refresh()
|
||||
Block::Refresh();
|
||||
}
|
||||
|
||||
QList<Node *> TrackOutput::GetImmediateDependenciesAt(const rational &time)
|
||||
QList<NodeDependency> TrackOutput::RunDependencies(NodeOutput* output, const rational &time)
|
||||
{
|
||||
QList<Node *> nodes = Node::GetImmediateDependencies();
|
||||
QList<NodeDependency> deps;
|
||||
|
||||
ValidateCurrentBlock(time);
|
||||
if (output == texture_output()) {
|
||||
ValidateCurrentBlock(time);
|
||||
|
||||
// Swap attached block for current block at this time
|
||||
nodes.removeAll(attached_block());
|
||||
if (current_block_ != this) {
|
||||
nodes.append(current_block_);
|
||||
if (current_block_ != this) {
|
||||
deps.append(NodeDependency(current_block_, time));
|
||||
}
|
||||
}
|
||||
|
||||
// The next track is not a direct dependency (it would only become so through a merge node)
|
||||
nodes.removeAll(next_track());
|
||||
|
||||
return nodes;
|
||||
return deps;
|
||||
}
|
||||
|
||||
void TrackOutput::GenerateBlockWidgets()
|
||||
@@ -133,7 +130,7 @@ void TrackOutput::DestroyBlockWidgets()
|
||||
|
||||
TrackOutput *TrackOutput::next_track()
|
||||
{
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value());
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value(0));
|
||||
}
|
||||
|
||||
NodeInput *TrackOutput::track_input()
|
||||
@@ -146,23 +143,27 @@ NodeOutput* TrackOutput::track_output()
|
||||
return track_output_;
|
||||
}
|
||||
|
||||
void TrackOutput::Process()
|
||||
#include "render/rendertexture.h"
|
||||
|
||||
QVariant TrackOutput::Value(NodeOutput *output, const rational &time)
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process();
|
||||
if (output == track_output_) {
|
||||
// Set track output correctly
|
||||
return PtrToValue(this);
|
||||
} else if (output == texture_output()) {
|
||||
ValidateCurrentBlock(time);
|
||||
|
||||
// Set track output correctly
|
||||
track_output_->set_value(PtrToValue(this));
|
||||
if (current_block_ != this) {
|
||||
// At this point, we must have found the correct block so we use its texture output to produce the image
|
||||
return current_block_->texture_output()->get_value(time);
|
||||
}
|
||||
|
||||
ValidateCurrentBlock(time());
|
||||
|
||||
if (current_block_ == this) {
|
||||
// No texture is valid
|
||||
texture_output()->set_value(0);
|
||||
} else {
|
||||
// At this point, we must have found the correct block so we use its texture output to produce the image
|
||||
texture_output()->set_value(current_block_->texture_output()->get_value());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Run default node processing
|
||||
return Block::Value(output, time);
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockBetweenBlocks(Block *block, Block *before, Block *after)
|
||||
@@ -181,7 +182,7 @@ void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
|
||||
Block *TrackOutput::attached_block()
|
||||
{
|
||||
return ValueToPtr<Block>(previous_input()->get_value());
|
||||
return ValueToPtr<Block>(previous_input()->get_value(0));
|
||||
}
|
||||
|
||||
void TrackOutput::PrependBlock(Block *block)
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/**
|
||||
* @brief Override swaps "attached block" with "current block"
|
||||
*/
|
||||
virtual QList<Node*> GetImmediateDependenciesAt(const rational& time) override;
|
||||
virtual QList<NodeDependency> RunDependencies(NodeOutput* param, const rational& time) override;
|
||||
|
||||
void GenerateBlockWidgets();
|
||||
|
||||
@@ -156,7 +156,7 @@ signals:
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
protected:
|
||||
virtual void Process() override;
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "viewer.h"
|
||||
|
||||
#include "panel/panelmanager.h"
|
||||
#include "render/rendertexture.h"
|
||||
|
||||
ViewerOutput::ViewerOutput() :
|
||||
attached_viewer_(nullptr)
|
||||
@@ -64,17 +64,6 @@ NodeInput *ViewerOutput::texture_input()
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ViewerOutput::Process()
|
||||
{
|
||||
if (attached_viewer_ != nullptr) {
|
||||
// Get the texture from whatever Node is currently connected (usually a Renderer of some kind)
|
||||
GLuint current_texture = texture_input_->get_value().value<GLuint>();
|
||||
|
||||
// Send the texture to the Viewer
|
||||
attached_viewer_->SetTexture(current_texture);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerOutput::AttachViewer(ViewerPanel *viewer)
|
||||
{
|
||||
// Disconnect old viewer if there's one attached
|
||||
@@ -94,14 +83,28 @@ void ViewerOutput::AttachViewer(ViewerPanel *viewer)
|
||||
void ViewerOutput::InvalidateCache(const rational &start_range, const rational &end_range)
|
||||
{
|
||||
// Update any attached viewer
|
||||
Process();
|
||||
ViewerTimeChanged(current_time_);
|
||||
|
||||
Node::InvalidateCache(start_range, end_range);
|
||||
}
|
||||
|
||||
QVariant ViewerOutput::Value(NodeOutput *output, const rational &time)
|
||||
{
|
||||
Q_UNUSED(output)
|
||||
Q_UNUSED(time)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ViewerOutput::ViewerTimeChanged(const rational &t)
|
||||
{
|
||||
set_time(t);
|
||||
// Get the texture from whatever Node is currently connected (usually a Renderer of some kind)
|
||||
RenderTexturePtr current_texture = texture_input_->get_value(t).value<RenderTexturePtr>();
|
||||
|
||||
Run();
|
||||
// Send the texture to the Viewer
|
||||
if (current_texture != nullptr) {
|
||||
attached_viewer_->SetTexture(current_texture->texture());
|
||||
}
|
||||
|
||||
current_time_ = t;
|
||||
}
|
||||
|
||||
@@ -47,17 +47,21 @@ public:
|
||||
void AttachViewer(ViewerPanel* viewer);
|
||||
|
||||
virtual void InvalidateCache(const rational &start_range, const rational &end_range) override;
|
||||
protected:
|
||||
|
||||
virtual void Process() override;
|
||||
protected:
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
private:
|
||||
void UpdateViewer();
|
||||
|
||||
NodeInput* texture_input_;
|
||||
|
||||
ViewerPanel* attached_viewer_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
rational current_time_;
|
||||
|
||||
private slots:
|
||||
void ViewerTimeChanged(const rational& t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user