separated setting time and processing node functions
This commit is contained in:
@@ -96,9 +96,8 @@ NodeInput *TimelineOutput::track_input()
|
||||
return track_input_;
|
||||
}
|
||||
|
||||
void TimelineOutput::Process(const rational &time)
|
||||
void TimelineOutput::Process()
|
||||
{
|
||||
Q_UNUSED(time)
|
||||
}
|
||||
|
||||
int TimelineOutput::GetTrackIndex(TrackOutput *track)
|
||||
@@ -119,7 +118,7 @@ rational TimelineOutput::GetSequenceLength()
|
||||
|
||||
TrackOutput *TimelineOutput::attached_track()
|
||||
{
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value(0));
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value());
|
||||
}
|
||||
|
||||
void TimelineOutput::AttachTrack(TrackOutput *track)
|
||||
@@ -202,7 +201,7 @@ void TimelineOutput::TrackConnectionRemoved(NodeEdgePtr edge)
|
||||
return;
|
||||
}
|
||||
|
||||
DetachTrack(ValueToPtr<TrackOutput>(edge->output()->get_value(0)));
|
||||
DetachTrack(ValueToPtr<TrackOutput>(edge->output()->get_value()));
|
||||
|
||||
if (attached_timeline_ != nullptr) {
|
||||
attached_timeline_->Clear();
|
||||
@@ -230,7 +229,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(0));
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value());
|
||||
|
||||
AttachTrack(added_track);
|
||||
}
|
||||
@@ -243,7 +242,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(0));
|
||||
TrackOutput* added_track = ValueToPtr<TrackOutput>(edge->output()->get_value());
|
||||
|
||||
DetachTrack(added_track);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
NodeInput* track_input();
|
||||
|
||||
protected:
|
||||
virtual void Process(const rational &time) override;
|
||||
virtual void Process() override;
|
||||
|
||||
private:
|
||||
int GetTrackIndex(TrackOutput* track);
|
||||
|
||||
@@ -133,7 +133,7 @@ void TrackOutput::DestroyBlockWidgets()
|
||||
|
||||
TrackOutput *TrackOutput::next_track()
|
||||
{
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value(0));
|
||||
return ValueToPtr<TrackOutput>(track_input_->get_value());
|
||||
}
|
||||
|
||||
NodeInput *TrackOutput::track_input()
|
||||
@@ -146,22 +146,22 @@ NodeOutput* TrackOutput::track_output()
|
||||
return track_output_;
|
||||
}
|
||||
|
||||
void TrackOutput::Process(const rational &time)
|
||||
void TrackOutput::Process()
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process(time);
|
||||
Block::Process();
|
||||
|
||||
// Set track output correctly
|
||||
track_output_->set_value(PtrToValue(this));
|
||||
|
||||
ValidateCurrentBlock(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(time));
|
||||
texture_output()->set_value(current_block_->texture_output()->get_value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
|
||||
Block *TrackOutput::attached_block()
|
||||
{
|
||||
return ValueToPtr<Block>(previous_input()->get_value(0));
|
||||
return ValueToPtr<Block>(previous_input()->get_value());
|
||||
}
|
||||
|
||||
void TrackOutput::PrependBlock(Block *block)
|
||||
|
||||
@@ -156,7 +156,7 @@ signals:
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
protected:
|
||||
virtual void Process(const rational &time) override;
|
||||
virtual void Process() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -64,11 +64,11 @@ NodeInput *ViewerOutput::texture_input()
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ViewerOutput::Process(const rational &time)
|
||||
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(time).value<GLuint>();
|
||||
GLuint current_texture = texture_input_->get_value().value<GLuint>();
|
||||
|
||||
// Send the texture to the Viewer
|
||||
attached_viewer_->SetTexture(current_texture);
|
||||
@@ -79,14 +79,29 @@ void ViewerOutput::AttachViewer(ViewerPanel *viewer)
|
||||
{
|
||||
// Disconnect old viewer if there's one attached
|
||||
if (attached_viewer_ != nullptr) {
|
||||
disconnect(attached_viewer_, SIGNAL(TimeChanged(const rational&)), this, SLOT(Run(const rational&)));
|
||||
disconnect(attached_viewer_, SIGNAL(TimeChanged(const rational&)), this, SLOT(ViewerTimeChanged(const rational&)));
|
||||
}
|
||||
|
||||
// FIXME: Currently this attaches to ViewerPanels, but should it attached to Viewers instead?
|
||||
attached_viewer_ = viewer;
|
||||
|
||||
if (attached_viewer_ != nullptr) {
|
||||
connect(attached_viewer_, SIGNAL(TimeChanged(const rational&)), this, SLOT(Run(const rational&)));
|
||||
connect(attached_viewer_, SIGNAL(TimeChanged(const rational&)), this, SLOT(ViewerTimeChanged(const rational&)));
|
||||
SetTimebase(timebase_);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateCache(const rational &start_range, const rational &end_range)
|
||||
{
|
||||
// Update any attached viewer
|
||||
Process();
|
||||
|
||||
Node::InvalidateCache(start_range, end_range);
|
||||
}
|
||||
|
||||
void ViewerOutput::ViewerTimeChanged(const rational &t)
|
||||
{
|
||||
set_time(t);
|
||||
|
||||
Run();
|
||||
}
|
||||
|
||||
@@ -46,8 +46,10 @@ public:
|
||||
|
||||
void AttachViewer(ViewerPanel* viewer);
|
||||
|
||||
virtual void InvalidateCache(const rational &start_range, const rational &end_range) override;
|
||||
protected:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
virtual void Process() override;
|
||||
|
||||
private:
|
||||
NodeInput* texture_input_;
|
||||
@@ -55,6 +57,10 @@ private:
|
||||
ViewerPanel* attached_viewer_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
private slots:
|
||||
void ViewerTimeChanged(const rational& t);
|
||||
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
Reference in New Issue
Block a user