Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/intern/COM_NodeGraph.cc')
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.cc34
1 files changed, 9 insertions, 25 deletions
diff --git a/source/blender/compositor/intern/COM_NodeGraph.cc b/source/blender/compositor/intern/COM_NodeGraph.cc
index 53b912fe5e4..7e05bf637b7 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cc
+++ b/source/blender/compositor/intern/COM_NodeGraph.cc
@@ -45,9 +45,8 @@ NodeGraph::NodeGraph()
NodeGraph::~NodeGraph()
{
- for (int index = 0; index < this->m_nodes.size(); index++) {
- Node *node = this->m_nodes[index];
- delete node;
+ while (m_nodes.size()) {
+ delete m_nodes.pop_last();
}
}
@@ -155,27 +154,11 @@ void NodeGraph::add_bNode(const CompositorContext &context,
}
}
-NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeSocket *b_socket)
-{
- NodeInputs result;
- for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- for (int index = 0; index < node->getNumberOfInputSockets(); index++) {
- NodeInput *input = node->getInputSocket(index);
- if (input->getbNodeSocket() == b_socket) {
- result.push_back(input);
- }
- }
- }
- return result;
-}
-
NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_socket)
{
for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
- for (int index = 0; index < node->getNumberOfOutputSockets(); index++) {
- NodeOutput *output = node->getOutputSocket(index);
+ for (NodeOutput *output : node->getOutputSockets()) {
if (output->getbNodeSocket() == b_socket) {
return output;
}
@@ -204,12 +187,13 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink
return;
}
- NodeInputs inputs = find_inputs(node_range, b_nodelink->tosock);
- for (NodeInput *input : inputs) {
- if (input->isLinked()) {
- continue;
+ for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
+ Node *node = *it;
+ for (NodeInput *input : node->getInputSockets()) {
+ if (input->getbNodeSocket() == b_nodelink->tosock && !input->isLinked()) {
+ add_link(output, input);
+ }
}
- add_link(output, input);
}
}