diff --git a/app/node/block/clip/clip.cpp b/app/node/block/clip/clip.cpp index b8560a49e..06b95dc40 100644 --- a/app/node/block/clip/clip.cpp +++ b/app/node/block/clip/clip.cpp @@ -79,17 +79,6 @@ void ClipBlock::InvalidateCache(const rational &start_range, const rational &end } } -QList ClipBlock::RunDependencies(NodeOutput *output, const rational &time) -{ - QList deps; - - if (output == buffer_output() && texture_input_->IsConnected()) { - deps.append(NodeDependency(texture_input_->get_connected_output(), SequenceToMediaTime(time), SequenceToMediaTime(time))); - } - - return deps; -} - TimeRange ClipBlock::InputTimeAdjustment(NodeInput *input, const TimeRange &input_time) { if (input == texture_input_) { diff --git a/app/node/block/clip/clip.h b/app/node/block/clip/clip.h index 072d9beda..967de76e6 100644 --- a/app/node/block/clip/clip.h +++ b/app/node/block/clip/clip.h @@ -44,8 +44,6 @@ public: virtual void InvalidateCache(const rational &start_range, const rational &end_range, NodeInput *from = nullptr) override; - virtual QList RunDependencies(NodeOutput *output, const rational &time) override; - virtual TimeRange InputTimeAdjustment(NodeInput* input, const TimeRange& input_time) override; private: diff --git a/app/node/node.cpp b/app/node/node.cpp index 53b76f2ae..dde64f042 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -290,30 +290,6 @@ QString Node::Code(NodeOutput *output) return QString(); } -QList Node::RunDependencies(NodeOutput *output, const rational &time) -{ - Q_UNUSED(output) - - QList run_deps; - - foreach (NodeParam* p, params_) { - if (p->type() == NodeParam::kInput) { - NodeInput* input = static_cast(p); - - // Check if Node is dependent on this input or not - if (input->dependent()) { - NodeOutput* potential_dep = input->get_connected_output(); - - if (potential_dep != nullptr) { - run_deps.append(NodeDependency(potential_dep, time, time)); - } - } - } - } - - return run_deps; -} - bool Node::OutputsTo(Node *n) { foreach (NodeParam* param, params_) { diff --git a/app/node/node.h b/app/node/node.h index 6fed53e7d..6a31a6b14 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -129,13 +129,6 @@ public: */ virtual QString Code(NodeOutput* output); - /** - * @brief For nodes that have different dependencies at different times, this function can be used for that purpose - * - * Only retrieves immmediate dependencies, meaning only nodes that are directly - */ - virtual QList RunDependencies(NodeOutput* output, const rational& time); - /** * @brief Returns whether this Node outputs data to the Node `n` in any way */ diff --git a/app/node/output/track/track.cpp b/app/node/output/track/track.cpp index 1ce1bbce1..9263a5261 100644 --- a/app/node/output/track/track.cpp +++ b/app/node/output/track/track.cpp @@ -122,21 +122,6 @@ void TrackOutput::SetIndex(const int &index) index_ = index; } -QList TrackOutput::RunDependencies(NodeOutput* output, const rational &time) -{ - QList deps; - - if (output == buffer_output()) { - ValidateCurrentBlock(time); - - if (current_block_ != this) { - deps.append(NodeDependency(current_block_->buffer_output(), time, time)); - } - } - - return deps; -} - TrackOutput *TrackOutput::next_track() { return ValueToPtr(track_input_->get_realtime_value_of_connected_output()); diff --git a/app/node/output/track/track.h b/app/node/output/track/track.h index 8b97fb16d..c6a4e3ab1 100644 --- a/app/node/output/track/track.h +++ b/app/node/output/track/track.h @@ -50,11 +50,6 @@ public: const int& Index(); void SetIndex(const int& index); - /** - * @brief Override swaps "attached block" with "current block" - */ - virtual QList RunDependencies(NodeOutput* param, const rational& time) override; - TrackOutput* next_track(); NodeInput* track_input(); diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index 6d4dbcb20..5d5c73386 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -62,24 +62,25 @@ void OpenGLWorker::Render(const NodeDependency &path) NodeOutput* output = path.node(); Node* node = output->parent(); - QList all_deps = node->GetDependencies(); + QList all_nodes_in_graph; + all_nodes_in_graph.append(node); + all_nodes_in_graph.append(node->GetDependencies()); // Lock all Nodes to prevent UI changes during this render - foreach (Node* dep, all_deps) { + foreach (Node* dep, all_nodes_in_graph) { dep->LockUserInput(); } - node->LockUserInput(); - // FIXME: Write traversal code + // Start traversing graph + RenderAsSibling(path); // Start OpenGL flushing now while we do clean up work on the CPU functions_->glFlush(); // Unlock all Nodes so changes can be made again - foreach (Node* dep, all_deps) { + foreach (Node* dep, all_nodes_in_graph) { dep->UnlockUserInput(); } - node->UnlockUserInput(); // Now we need the texture done so we call glFinish() functions_->glFinish(); @@ -112,6 +113,24 @@ void OpenGLWorker::FinishInit() qDebug() << "Context in" << ctx_->thread() << "successfully finished"; } -void OpenGLWorker::RenderAsSibling(const NodeDependency &) +void OpenGLWorker::RenderAsSibling(const NodeDependency &dep) { + NodeOutput* output = dep.node(); + Node* node = output->parent(); + + node->LockProcessing(); + + // Check if block + // If yes, traverse previous and next until we find the right block + // Check all inputs for ones that are dependents + // If input is NOT connected, set stored value to keyframe at time + // Some inputs we handle ourselves such as FOOTAGE + // If input IS connected, we need to traverse down it + // If more than one input is connected, signal out for a sibling to handle it + // Keep iterating inputs until all are up to date + // Finally get value from output + // If we have shader code, the output is a texture and we handle the I/O + // If we don't, the output is some other value and the Node will produce the output + + node->UnlockProcessing(); } diff --git a/app/render/backend/opengl/openglworker.h b/app/render/backend/opengl/openglworker.h index e611254ef..cf9101f19 100644 --- a/app/render/backend/opengl/openglworker.h +++ b/app/render/backend/opengl/openglworker.h @@ -71,7 +71,7 @@ private: private slots: void FinishInit(); - void RenderAsSibling(const NodeDependency& path); + void RenderAsSibling(const NodeDependency& dep); }; #endif // OPENGLPROCESSOR_H