shifted to new dependency structure
This commit is contained in:
+15
-11
@@ -70,7 +70,7 @@ void Block::set_length(const rational &length)
|
||||
|
||||
Block *Block::previous()
|
||||
{
|
||||
return ValueToPtr<Block>(previous_input_->get_value());
|
||||
return ValueToPtr<Block>(previous_input_->get_value(0));
|
||||
}
|
||||
|
||||
Block *Block::next()
|
||||
@@ -83,10 +83,16 @@ NodeInput *Block::previous_input()
|
||||
return previous_input_;
|
||||
}
|
||||
|
||||
void Block::Process()
|
||||
QVariant Block::Value(NodeOutput *output, const rational &time)
|
||||
{
|
||||
// Simply set both output values as a pointer to this object
|
||||
block_output_->set_value(PtrToValue(this));
|
||||
Q_UNUSED(time)
|
||||
|
||||
if (output == block_output_) {
|
||||
// Simply set the output value to a pointer to this Block
|
||||
return PtrToValue(this);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Block::EdgeAddedSlot(NodeEdgePtr edge)
|
||||
@@ -174,14 +180,12 @@ void Block::set_media_in(const rational &media_in)
|
||||
}
|
||||
}
|
||||
|
||||
QList<Node *> Block::GetImmediateDependenciesAt(const rational &time)
|
||||
QList<NodeDependency> Block::RunDependencies(NodeOutput* param, const rational &time)
|
||||
{
|
||||
// Base Blocks have no direct dependencies
|
||||
|
||||
Q_UNUSED(param)
|
||||
Q_UNUSED(time)
|
||||
|
||||
QList<Node *> nodes = Node::GetImmediateDependencies();
|
||||
|
||||
// Swap attached block for current block at this time
|
||||
nodes.removeAll(previous());
|
||||
|
||||
return nodes;
|
||||
return QList<NodeDependency>();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
/**
|
||||
* @brief Override removes previous input as that is not a direct dependency
|
||||
*/
|
||||
virtual QList<Node *> GetImmediateDependenciesAt(const rational &time) override;
|
||||
virtual QList<NodeDependency> RunDependencies(NodeOutput* output, const rational &time) override;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ signals:
|
||||
void Refreshed();
|
||||
|
||||
protected:
|
||||
virtual void Process() override;
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
private:
|
||||
NodeInput* previous_input_;
|
||||
|
||||
@@ -67,31 +67,26 @@ NodeInput *ClipBlock::texture_input()
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ClipBlock::set_time(const rational &time)
|
||||
rational ClipBlock::SequenceToMediaTime(const rational &sequence_time)
|
||||
{
|
||||
Node::set_time(time);
|
||||
|
||||
if (texture_input_->IsConnected()) {
|
||||
// We convert the time given (timeline time) to media time
|
||||
rational media_time = time - in() + media_in();
|
||||
|
||||
texture_input_->edges().first()->output()->parent()->set_time(media_time);
|
||||
}
|
||||
return sequence_time - in() + media_in();
|
||||
}
|
||||
|
||||
void ClipBlock::Process()
|
||||
QVariant ClipBlock::Value(NodeOutput* param, const rational& time)
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process();
|
||||
QVariant value = Block::Value(param, time);
|
||||
|
||||
// Check if we have a renderer instance
|
||||
if (RendererProcessor::CurrentInstance() != nullptr) {
|
||||
if (param == texture_output()) {
|
||||
// If the time retrieved is within this block, get texture information
|
||||
if (time() >= in() && time() < out()) {
|
||||
if (time >= in() && time < out()) {
|
||||
// We convert the time given (timeline time) to media time
|
||||
rational media_time = SequenceToMediaTime(time - in() + media_in());
|
||||
|
||||
// Retrieve texture
|
||||
texture_output()->set_value(texture_input_->get_value());
|
||||
} else {
|
||||
texture_output()->set_value(0);
|
||||
return texture_input_->get_value(media_time);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Block::Value(param, time);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ public:
|
||||
|
||||
NodeInput* texture_input();
|
||||
|
||||
virtual void set_time(const rational& time) override;
|
||||
|
||||
protected:
|
||||
virtual void Process() override;
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
private:
|
||||
rational SequenceToMediaTime(const rational& sequence_time);
|
||||
|
||||
NodeInput* texture_input_;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user