node: removed slow unrecommended functions
This commit is contained in:
@@ -1555,64 +1555,6 @@ void Node::GenerateFrame(FramePtr frame, const GenerateJob &job) const
|
||||
Q_UNUSED(job)
|
||||
}
|
||||
|
||||
bool Node::OutputsTo(Node *n, bool recursively, const OutputConnections &ignore_edges, const OutputConnection &added_edge) const
|
||||
{
|
||||
for (const OutputConnection& conn : output_connections_) {
|
||||
if (std::find(ignore_edges.cbegin(), ignore_edges.cend(), conn) != ignore_edges.cend()) {
|
||||
// If this edge is in the "ignore edges" list, skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
Node* connected = conn.second.node();
|
||||
|
||||
if (connected == n) {
|
||||
return true;
|
||||
} else if (recursively && connected->OutputsTo(n, recursively, ignore_edges, added_edge)) {
|
||||
return true;
|
||||
} else if (added_edge.first == this) {
|
||||
Node *proposed_connected = added_edge.second.node();
|
||||
|
||||
if (proposed_connected == n) {
|
||||
return true;
|
||||
} else if (recursively && proposed_connected->OutputsTo(n, recursively, ignore_edges, added_edge)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::OutputsTo(const QString &id, bool recursively) const
|
||||
{
|
||||
for (const OutputConnection& conn : output_connections_) {
|
||||
Node* connected = conn.second.node();
|
||||
|
||||
if (connected->id() == id) {
|
||||
return true;
|
||||
} else if (recursively && connected->OutputsTo(id, recursively)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::OutputsTo(const NodeInput &input, bool recursively) const
|
||||
{
|
||||
for (const OutputConnection& conn : output_connections_) {
|
||||
const NodeInput& connected = conn.second;
|
||||
|
||||
if (connected == input) {
|
||||
return true;
|
||||
} else if (recursively && connected.node()->OutputsTo(input, recursively)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::InputsFrom(Node *n, bool recursively) const
|
||||
{
|
||||
for (auto it=input_connections_.cbegin(); it!=input_connections_.cend(); it++) {
|
||||
@@ -1643,28 +1585,6 @@ bool Node::InputsFrom(const QString &id, bool recursively) const
|
||||
return false;
|
||||
}
|
||||
|
||||
int Node::GetNumberOfRoutesTo(Node *n) const
|
||||
{
|
||||
bool outputs_directly = false;
|
||||
int routes = 0;
|
||||
|
||||
foreach (const OutputConnection& conn, output_connections_) {
|
||||
Node* connected_node = conn.second.node();
|
||||
|
||||
if (connected_node == n) {
|
||||
outputs_directly = true;
|
||||
} else {
|
||||
routes += connected_node->GetNumberOfRoutesTo(n);
|
||||
}
|
||||
}
|
||||
|
||||
if (outputs_directly) {
|
||||
routes++;
|
||||
}
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
void Node::DisconnectAll()
|
||||
{
|
||||
// Disconnect inputs (copy map since internal map will change as we disconnect)
|
||||
|
||||
@@ -786,30 +786,6 @@ public:
|
||||
*/
|
||||
virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const;
|
||||
|
||||
/**
|
||||
* @brief Returns whether this Node outputs to `n`
|
||||
*
|
||||
* @param n
|
||||
*
|
||||
* The node instance to check.
|
||||
*
|
||||
* @param recursively
|
||||
*
|
||||
* Whether to keep traversing down outputs to find this node (TRUE) or stick to immediate outputs
|
||||
* (FALSE).
|
||||
*/
|
||||
bool OutputsTo(Node* n, bool recursively, const OutputConnections &ignore_edges = OutputConnections(), const OutputConnection &added_edge = OutputConnection()) const;
|
||||
|
||||
/**
|
||||
* @brief Same as OutputsTo(Node*), but for a node ID rather than a specific instance.
|
||||
*/
|
||||
bool OutputsTo(const QString& id, bool recursively) const;
|
||||
|
||||
/**
|
||||
* @brief Same as OutputsTo(Node*), but for a specific node input rather than just a node.
|
||||
*/
|
||||
bool OutputsTo(const NodeInput &input, bool recursively) const;
|
||||
|
||||
/**
|
||||
* @brief Returns whether this node ever receives an input from a particular node instance
|
||||
*/
|
||||
@@ -820,7 +796,6 @@ public:
|
||||
*/
|
||||
bool InputsFrom(const QString& id, bool recursively) const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Find inputs that `output` outputs to in order to arrive at this node
|
||||
*
|
||||
@@ -829,11 +804,6 @@ public:
|
||||
*/
|
||||
QVector<NodeInput> FindWaysNodeArrivesHere(const Node *output) const;
|
||||
|
||||
/**
|
||||
* @brief Determines how many paths go from this node out to another node
|
||||
*/
|
||||
int GetNumberOfRoutesTo(Node* n) const;
|
||||
|
||||
/**
|
||||
* @brief Severs all input and output connections
|
||||
*/
|
||||
@@ -866,12 +836,6 @@ public:
|
||||
template<class T>
|
||||
static QVector<T*> FindInputNodesConnectedToInput(const NodeInput &input, int maximum = 0);
|
||||
|
||||
template<class T>
|
||||
/**
|
||||
* @brief Find a node of a certain type that this Node outputs to
|
||||
*/
|
||||
QVector<T *> FindOutputNode();
|
||||
|
||||
/**
|
||||
* @brief Convert a pointer to a value that can be sent between NodeParams
|
||||
*/
|
||||
@@ -1413,9 +1377,6 @@ private:
|
||||
template<class T>
|
||||
static void FindInputNodeInternal(const Node* n, QVector<T *>& list, int maximum);
|
||||
|
||||
template<class T>
|
||||
static void FindOutputNodeInternal(const Node* n, QVector<T *>& list);
|
||||
|
||||
QVector<Node*> GetDependenciesInternal(bool traverse, bool exclusive_only) const;
|
||||
|
||||
void ParameterValueChanged(const QString &input, int element, const olive::TimeRange &range);
|
||||
@@ -1573,31 +1534,6 @@ T* Node::ValueToPtr(const QVariant &ptr)
|
||||
return reinterpret_cast<T*>(ptr.value<quintptr>());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Node::FindOutputNodeInternal(const Node* n, QVector<T *>& list)
|
||||
{
|
||||
foreach (const OutputConnection& output, n->output_connections_) {
|
||||
Node* connected = output.second.node();
|
||||
T* cast_test = dynamic_cast<T*>(connected);
|
||||
|
||||
if (cast_test) {
|
||||
list.append(cast_test);
|
||||
}
|
||||
|
||||
FindOutputNodeInternal<T>(connected, list);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
QVector<T *> Node::FindOutputNode()
|
||||
{
|
||||
QVector<T *> list;
|
||||
|
||||
FindOutputNodeInternal<T>(this, list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
using NodePtr = std::shared_ptr<Node>;
|
||||
|
||||
class NodeSetPositionCommand : public UndoCommand
|
||||
|
||||
@@ -1043,7 +1043,7 @@ void NodeView::ProcessMovingAttachedNodes(const QPoint &pos)
|
||||
}
|
||||
}
|
||||
|
||||
if (new_drop_edge->input().node()->OutputsTo(attached_node, true)) {
|
||||
if (attached_node->InputsFrom(new_drop_edge->input().node(), true)) {
|
||||
drop_input_.Reset();
|
||||
}
|
||||
|
||||
@@ -1079,7 +1079,7 @@ QVector<Node*> NodeView::ProcessDroppingAttachedNodes(MultiUndoCommand *command,
|
||||
for (int i=0; i<attached.size(); i++) {
|
||||
const AttachedItem &ai = attached.at(i);
|
||||
|
||||
if (select_context->OutputsTo(ai.node, true)) {
|
||||
if (ai.node->InputsFrom(select_context, true)) {
|
||||
attached.removeAt(i);
|
||||
} else if (select_context->ContextContainsNode(ai.node)) {
|
||||
select_nodes.append(ai.node);
|
||||
@@ -1118,7 +1118,7 @@ QVector<Node*> NodeView::ProcessDroppingAttachedNodes(MultiUndoCommand *command,
|
||||
Node* dropping_node = nullptr;
|
||||
|
||||
foreach (const AttachedItem &ai, attached) {
|
||||
if (ai.item && !select_context->OutputsTo(ai.node, true)) {
|
||||
if (ai.item && !ai.node->InputsFrom(select_context, true)) {
|
||||
dropping_node = ai.node;
|
||||
break;
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ void NodeView::PositionNewEdge(const QPoint &pos)
|
||||
|
||||
// Filter out connecting to a node that connects to us or an item of the same type
|
||||
if (item_at_cursor
|
||||
&& ((create_edge_from_output_ && item_at_cursor->GetNode()->OutputsTo(source_item->GetNode(), true))
|
||||
&& ((create_edge_from_output_ && source_item->GetNode()->InputsFrom(item_at_cursor->GetNode(), true))
|
||||
|| (!create_edge_from_output_ && item_at_cursor->GetNode()->InputsFrom(source_item->GetNode(), true))
|
||||
|| (create_edge_from_output_ == item_at_cursor->IsOutputItem()))) {
|
||||
item_at_cursor = nullptr;
|
||||
@@ -1412,7 +1412,7 @@ void NodeView::GroupNodes()
|
||||
// Default to the first node we find that doesn't output to a node inside the group
|
||||
output_passthrough = nodes_to_group.first();
|
||||
foreach (Node *potential_in, nodes_to_group) {
|
||||
if (potential_in != n && !n->OutputsTo(potential_in, false)) {
|
||||
if (potential_in != n && !potential_in->InputsFrom(n, false)) {
|
||||
output_passthrough = n;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const DraggedFootageData
|
||||
for (auto it=sorted.cbegin(); it!=sorted.cend(); it++) {
|
||||
ViewerOutput* footage = it->first;
|
||||
|
||||
if (footage == sequence() || (sequence() && sequence()->OutputsTo(footage, true))) {
|
||||
if (footage == sequence() || (sequence() && footage->InputsFrom(sequence(), true))) {
|
||||
// Prevent cyclical dependency
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user