diff --git a/app/node/input.cpp b/app/node/input.cpp index acde2405b..44b614f8c 100644 --- a/app/node/input.cpp +++ b/app/node/input.cpp @@ -73,7 +73,7 @@ Node *NodeInput::get_connected_node() NodeOutput* output = get_connected_output(); if (output != nullptr) { - return output->parent(); + return output->parentNode(); } return nullptr; @@ -129,8 +129,8 @@ QVariant NodeInput::get_value_at_time(const rational &time) void NodeInput::set_value_at_time(const rational &time, const QVariant &value) { - if (parent() != nullptr) - parent()->LockUserInput(); + if (parentNode() != nullptr) + parentNode()->LockUserInput(); // We set up these variables in advance (see end of function) bool signal_vc = false; @@ -216,8 +216,8 @@ void NodeInput::set_value_at_time(const rational &time, const QVariant &value) signal_vc_range = TimeRange(RATIONAL_MIN, RATIONAL_MAX); } - if (parent() != nullptr) - parent()->UnlockUserInput(); + if (parentNode() != nullptr) + parentNode()->UnlockUserInput(); // We make sure this signal is emitted AFTER we've unlocked the node in case this leads to a tangent where something // tries to relock this node before it's unlocked here @@ -298,8 +298,8 @@ void NodeInput::set_maximum(const QVariant &max) void NodeInput::CopyValues(NodeInput *source, NodeInput *dest, bool include_connections) { - source->parent()->LockUserInput(); - dest->parent()->LockUserInput(); + source->parentNode()->LockUserInput(); + dest->parentNode()->LockUserInput(); // Copy values dest->keyframes_ = source->keyframes_; @@ -307,8 +307,8 @@ void NodeInput::CopyValues(NodeInput *source, NodeInput *dest, bool include_conn // Copy keyframing state dest->set_is_keyframing(source->is_keyframing()); - source->parent()->UnlockUserInput(); - dest->parent()->UnlockUserInput(); + source->parentNode()->UnlockUserInput(); + dest->parentNode()->UnlockUserInput(); // Copy connections if (include_connections && source->get_connected_output() != nullptr) { diff --git a/app/node/inputarray.cpp b/app/node/inputarray.cpp new file mode 100644 index 000000000..756692042 --- /dev/null +++ b/app/node/inputarray.cpp @@ -0,0 +1,6 @@ +#include "inputarray.h" + +InputArray::InputArray() +{ + +} diff --git a/app/node/inputarray.h b/app/node/inputarray.h new file mode 100644 index 000000000..ec2bdeea1 --- /dev/null +++ b/app/node/inputarray.h @@ -0,0 +1,11 @@ +#ifndef INPUTARRAY_H +#define INPUTARRAY_H + + +class InputArray +{ +public: + InputArray(); +}; + +#endif // INPUTARRAY_H diff --git a/app/node/node.cpp b/app/node/node.cpp index 30ecc6059..6ef47e2d8 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -106,7 +106,7 @@ void Node::SendInvalidateCache(const rational &start_range, const rational &end_ foreach (NodeEdgePtr edge, edges) { NodeInput* connected_input = edge->input(); - Node* connected_node = connected_input->parent(); + Node* connected_node = connected_input->parentNode(); // Send clear cache signal to the Node connected_node->InvalidateCache(start_range, end_range, connected_input); @@ -125,7 +125,7 @@ void Node::DependentEdgeChanged(NodeInput *from) foreach (NodeEdgePtr edge, out->edges()) { NodeInput* connected_input = edge->input(); - Node* connected_node = connected_input->parent(); + Node* connected_node = connected_input->parentNode(); connected_node->DependentEdgeChanged(connected_input); } @@ -204,14 +204,14 @@ void Node::DuplicateConnectionsBetweenLists(const QList &source, const Q // Get this input's connected outputs NodeOutput* source_output = source_input->get_connected_output(); - Node* source_output_node = source_output->parent(); + Node* source_output_node = source_output->parentNode(); // Find equivalent in destination list Node* dest_output_node = destination.at(source.indexOf(source_output_node)); Q_ASSERT(dest_output_node->id() == source_output_node->id()); - NodeOutput* dest_output = static_cast(dest_output_node->params_.at(source_output->index())); + NodeOutput* dest_output = static_cast(dest_output_node->GetParameterWithID(source_output->id())); NodeParam::ConnectEdge(dest_output, dest_input); } @@ -323,7 +323,7 @@ QList Node::GetExclusiveDependencies() // If any edge goes to from an output here to an input of a Node that isn't in this dep list, it's NOT an // exclusive dependency - if (deps.contains(edge->input()->parent())) { + if (deps.contains(edge->input()->parentNode())) { deps.removeAt(i); i--; // -1 since we just removed a Node in this list diff --git a/app/node/output.cpp b/app/node/output.cpp index 217d11955..84029bea0 100644 --- a/app/node/output.cpp +++ b/app/node/output.cpp @@ -34,7 +34,7 @@ NodeParam::Type NodeOutput::type() QVariant NodeOutput::get_realtime_value() { - QVariant v = parent()->Value(this); + QVariant v = parentNode()->Value(this); return v; } diff --git a/app/node/param.cpp b/app/node/param.cpp index 2adbb8467..9f9ce32a6 100644 --- a/app/node/param.cpp +++ b/app/node/param.cpp @@ -56,14 +56,26 @@ void NodeParam::set_name(const QString &name) name_ = name; } -Node *NodeParam::parent() +Node *NodeParam::parentNode() { - return static_cast(QObject::parent()); + QObject* p = parent(); + + while (p != nullptr) { + // Determine if this object is a Node or not + Node* cast_test = dynamic_cast(p); + if (cast_test != nullptr) { + return cast_test; + } + + p = p->parent(); + } + + return nullptr; } int NodeParam::index() { - return parent()->IndexOfParameter(this); + return parentNode()->IndexOfParameter(this); } bool NodeParam::IsConnected() @@ -96,7 +108,7 @@ NodeEdgePtr NodeParam::ConnectEdge(NodeOutput *output, NodeInput *input) } // Ensure both nodes are in the same graph - if (output->parent()->parent() != input->parent()->parent()) { + if (output->parentNode()->parent() != input->parentNode()->parent()) { qWarning() << "Tried to connect two nodes that aren't part of the same graph"; return nullptr; } @@ -105,16 +117,16 @@ NodeEdgePtr NodeParam::ConnectEdge(NodeOutput *output, NodeInput *input) // The nodes should never be the same, and since we lock both nodes here, this can lead to a entire program freeze // that's difficult to diagnose. This makes that issue very clear. - Q_ASSERT(output->parent() != input->parent()); + Q_ASSERT(output->parentNode() != input->parentNode()); - output->parent()->LockUserInput(); - input->parent()->LockUserInput(); + output->parentNode()->LockUserInput(); + input->parentNode()->LockUserInput(); output->edges_.append(edge); input->edges_.append(edge); - output->parent()->UnlockUserInput(); - input->parent()->UnlockUserInput(); + output->parentNode()->UnlockUserInput(); + input->parentNode()->UnlockUserInput(); // Emit a signal than an edge was added (only one signal needs emitting) emit input->EdgeAdded(edge); @@ -127,14 +139,14 @@ void NodeParam::DisconnectEdge(NodeEdgePtr edge) NodeOutput* output = edge->output(); NodeInput* input = edge->input(); - output->parent()->LockUserInput(); - input->parent()->LockUserInput(); + output->parentNode()->LockUserInput(); + input->parentNode()->LockUserInput(); output->edges_.removeOne(edge); input->edges_.removeOne(edge); - output->parent()->UnlockUserInput(); - input->parent()->UnlockUserInput(); + output->parentNode()->UnlockUserInput(); + input->parentNode()->UnlockUserInput(); emit input->EdgeRemoved(edge); } diff --git a/app/node/param.h b/app/node/param.h index 70ecf3a1e..d037b6caa 100644 --- a/app/node/param.h +++ b/app/node/param.h @@ -141,7 +141,7 @@ public: * Nodes and NodeParams use the QObject parent-child system. This function is a convenience function for * static_cast(QObject::parent()) */ - Node* parent(); + Node* parentNode(); /** * @brief Return the row index of this parameter in the parent node (primarily used for UI drawing functions) diff --git a/app/render/backend/audiorenderworker.cpp b/app/render/backend/audiorenderworker.cpp index e5768b838..708a27bb6 100644 --- a/app/render/backend/audiorenderworker.cpp +++ b/app/render/backend/audiorenderworker.cpp @@ -15,7 +15,7 @@ void AudioRenderWorker::SetParameters(const AudioRenderingParams &audio_params) QVariant AudioRenderWorker::RenderAsSibling(NodeDependency dep) { NodeOutput* output = dep.node(); - Node* node = output->parent(); + Node* node = output->parentNode(); QList connected_inputs; QVariant value; @@ -66,7 +66,7 @@ void AudioRenderWorker::CloseInternal() QVariant AudioRenderWorker::RenderBlock(NodeOutput* output, const TimeRange &range) { - QList active_blocks = ValidateBlockRange(static_cast(output->parent()), range); + QList active_blocks = ValidateBlockRange(static_cast(output->parentNode()), range); // All these blocks will need to output to a buffer so we create one here QByteArray block_range_buffer(audio_params_.time_to_bytes(range.length()), 0); diff --git a/app/render/backend/opengl/openglbackend.cpp b/app/render/backend/opengl/openglbackend.cpp index b700b28eb..73e37a750 100644 --- a/app/render/backend/opengl/openglbackend.cpp +++ b/app/render/backend/opengl/openglbackend.cpp @@ -88,7 +88,7 @@ bool OpenGLBackend::TraverseCompiling(Node *n) // Check if we have a shader or not if (shader_cache_.GetShader(connected_output) == nullptr) { // Since we don't have a shader, compile one now - QString node_code = connected_output->parent()->Code(connected_output); + QString node_code = connected_output->parentNode()->Code(connected_output); // If the node has no code, it mustn't be GPU accelerated if (!node_code.isEmpty()) { @@ -126,7 +126,7 @@ bool OpenGLBackend::TraverseCompiling(Node *n) } } - if (!TraverseCompiling(connected_output->parent())) { + if (!TraverseCompiling(connected_output->parentNode())) { return false; } } diff --git a/app/render/backend/opengl/openglshadercache.cpp b/app/render/backend/opengl/openglshadercache.cpp index 92df2171f..d02d7f7a1 100644 --- a/app/render/backend/opengl/openglshadercache.cpp +++ b/app/render/backend/opengl/openglshadercache.cpp @@ -10,7 +10,7 @@ OpenGLShaderCache::OpenGLShaderCache() QString OpenGLShaderCache::GenerateShaderID(NodeOutput *output) { // Creates a unique identifier for this specific node and this specific output - return QString("%1:%2").arg(output->parent()->id(), output->id()); + return QString("%1:%2").arg(output->parentNode()->id(), output->id()); } void OpenGLShaderCache::Clear() diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index a38c8329b..ba8dfe07d 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -86,7 +86,7 @@ void OpenGLWorker::ParametersChangedEvent() QVariant OpenGLWorker::RunNodeAccelerated(NodeOutput *out) { OpenGLShaderPtr shader = shader_cache_->GetShader(out); - Node* node = out->parent(); + Node* node = out->parentNode(); // Create the output texture OpenGLTexturePtr output = std::make_shared(); diff --git a/app/render/backend/renderworker.cpp b/app/render/backend/renderworker.cpp index 8439938b1..e88266d3f 100644 --- a/app/render/backend/renderworker.cpp +++ b/app/render/backend/renderworker.cpp @@ -171,7 +171,7 @@ QList RenderWorker::ProcessNodeInputsForTime(Node *n, const TimeRang QVariant RenderWorker::ProcessNodeNormally(const NodeDependency& dep) { NodeOutput* output = dep.node(); - Node* node = dep.node()->parent(); + Node* node = dep.node()->parentNode(); //qDebug() << "Processing" << node->id(); diff --git a/app/render/backend/videorenderworker.cpp b/app/render/backend/videorenderworker.cpp index 75c72d141..f9977abca 100644 --- a/app/render/backend/videorenderworker.cpp +++ b/app/render/backend/videorenderworker.cpp @@ -21,7 +21,7 @@ void VideoRenderWorker::RenderInternal(const NodeDependency& path) // Get hash of node graph // We use SHA-1 for speed (benchmarks show it's the fastest hash available to us) QCryptographicHash hasher(QCryptographicHash::Sha1); - HashNodeRecursively(&hasher, path.node()->parent(), path.in()); + HashNodeRecursively(&hasher, path.node()->parentNode(), path.in()); QByteArray hash = hasher.result(); if (frame_cache_->HasHash(hash)) { @@ -123,7 +123,7 @@ void VideoRenderWorker::CloseInternal() QVariant VideoRenderWorker::RenderAsSibling(NodeDependency dep) { NodeOutput* output = dep.node(); - Node* original_node = output->parent(); + Node* original_node = output->parentNode(); Node* node; rational time = dep.in(); QVariant value; diff --git a/app/widget/nodeview/nodeviewedge.cpp b/app/widget/nodeview/nodeviewedge.cpp index 7939f7aad..9b60c6228 100644 --- a/app/widget/nodeview/nodeviewedge.cpp +++ b/app/widget/nodeview/nodeviewedge.cpp @@ -80,8 +80,8 @@ void NodeViewEdge::Adjust() } // Get the UI objects of both nodes that this edge connects - NodeViewItem* output = NodeView::NodeToUIObject(scene(), edge_->output()->parent()); - NodeViewItem* input = NodeView::NodeToUIObject(scene(), edge_->input()->parent()); + NodeViewItem* output = NodeView::NodeToUIObject(scene(), edge_->output()->parentNode()); + NodeViewItem* input = NodeView::NodeToUIObject(scene(), edge_->input()->parentNode()); // Create initial values QPointF output_point = QPointF(output->pos().x() + output->rect().width(), 0); diff --git a/app/widget/nodeview/nodeviewitem.cpp b/app/widget/nodeview/nodeviewitem.cpp index 3c35a65b4..b0d283c1a 100644 --- a/app/widget/nodeview/nodeviewitem.cpp +++ b/app/widget/nodeview/nodeviewitem.cpp @@ -304,7 +304,7 @@ void NodeViewItem::mousePressEvent(QGraphicsSceneMouseEvent *event) drag_src_param_ = edge->output(); // Get its Node UI object - drag_source_ = NodeView::NodeToUIObject(scene(), drag_src_param_->parent()); + drag_source_ = NodeView::NodeToUIObject(scene(), drag_src_param_->parentNode()); // Get the opposing parameter's rect center using the line's current coordinates // (we use the current coordinates because a complex formula is used for the line's coords if the opposing @@ -387,11 +387,11 @@ void NodeViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // Determine which Node will be "submitting output" and which node will be "receiving input" if (drag_src_param_->type() == NodeParam::kInput) { - receiving_node = drag_src_param_->parent(); + receiving_node = drag_src_param_->parentNode(); outputting_node = drop_item->node(); } else { receiving_node = drop_item->node(); - outputting_node = drag_src_param_->parent(); + outputting_node = drag_src_param_->parentNode(); } // Ensure the receiving node doesn't output to the outputting node