separated setting time and processing node functions
This commit is contained in:
@@ -70,7 +70,7 @@ void Block::set_length(const rational &length)
|
||||
|
||||
Block *Block::previous()
|
||||
{
|
||||
return ValueToPtr<Block>(previous_input_->get_value(0));
|
||||
return ValueToPtr<Block>(previous_input_->get_value());
|
||||
}
|
||||
|
||||
Block *Block::next()
|
||||
@@ -83,10 +83,8 @@ NodeInput *Block::previous_input()
|
||||
return previous_input_;
|
||||
}
|
||||
|
||||
void Block::Process(const rational &time)
|
||||
void Block::Process()
|
||||
{
|
||||
Q_UNUSED(time)
|
||||
|
||||
// Simply set both output values as a pointer to this object
|
||||
block_output_->set_value(PtrToValue(this));
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ signals:
|
||||
void Refreshed();
|
||||
|
||||
protected:
|
||||
virtual void Process(const rational &time) override;
|
||||
virtual void Process() override;
|
||||
|
||||
private:
|
||||
NodeInput* previous_input_;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "clip.h"
|
||||
|
||||
#include "node/processor/renderer/renderer.h"
|
||||
|
||||
ClipBlock::ClipBlock()
|
||||
{
|
||||
texture_input_ = new NodeInput("tex_in");
|
||||
@@ -65,17 +67,31 @@ NodeInput *ClipBlock::texture_input()
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ClipBlock::Process(const rational &time)
|
||||
void ClipBlock::set_time(const rational &time)
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process(time);
|
||||
Node::set_time(time);
|
||||
|
||||
// If the time retrieved is within this block, get texture information
|
||||
if (time >= in() && time < out()) {
|
||||
if (texture_input_->IsConnected()) {
|
||||
// We convert the time given (timeline time) to media time
|
||||
rational media_time = time - in() + media_in();
|
||||
|
||||
// Retrieve texture
|
||||
texture_output()->set_value(texture_input_->get_value(media_time));
|
||||
texture_input_->edges().first()->output()->parent()->set_time(media_time);
|
||||
}
|
||||
}
|
||||
|
||||
void ClipBlock::Process()
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process();
|
||||
|
||||
// Check if we have a renderer instance
|
||||
if (RendererProcessor::CurrentInstance() != nullptr) {
|
||||
// If the time retrieved is within this block, get texture information
|
||||
if (time() >= in() && time() < out()) {
|
||||
// Retrieve texture
|
||||
texture_output()->set_value(texture_input_->get_value());
|
||||
} else {
|
||||
texture_output()->set_value(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,10 @@ public:
|
||||
|
||||
NodeInput* texture_input();
|
||||
|
||||
virtual void set_time(const rational& time) override;
|
||||
|
||||
protected:
|
||||
virtual void Process(const rational &time) override;
|
||||
virtual void Process() override;
|
||||
|
||||
private:
|
||||
NodeInput* texture_input_;
|
||||
|
||||
Reference in New Issue
Block a user