Cleanup: Replace std::vector with blender::Vector.

This commit is contained in:
Jeroen Bakker 2021-03-26 11:55:13 +01:00
parent acc6e5c315
commit 23b1872d6e
3 changed files with 8 additions and 13 deletions

View File

@ -83,7 +83,7 @@ void NodeGraph::add_node(Node *node,
node->setInstanceKey(key);
node->setIsInActiveGroup(is_active_group);
m_nodes.push_back(node);
m_nodes.append(node);
DebugInfo::node_added(node);
}
@ -156,7 +156,7 @@ void NodeGraph::add_bNode(const CompositorContext &context,
NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeSocket *b_socket)
{
NodeInputs result;
for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
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);
@ -170,7 +170,7 @@ NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeS
NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_socket)
{
for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
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);

View File

@ -22,7 +22,6 @@
#include <map>
#include <set>
#include <vector>
#include "DNA_node_types.h"
@ -50,18 +49,15 @@ class NodeGraph {
}
};
typedef std::vector<Node *> Nodes;
typedef Nodes::iterator NodeIterator;
private:
Nodes m_nodes;
blender::Vector<Node *> m_nodes;
blender::Vector<Link> m_links;
public:
NodeGraph();
~NodeGraph();
const Nodes &nodes() const
const blender::Vector<Node *> &nodes() const
{
return m_nodes;
}
@ -73,7 +69,8 @@ class NodeGraph {
void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
protected:
typedef std::pair<NodeIterator, NodeIterator> NodeRange;
typedef std::pair<blender::Vector<Node *>::iterator, blender::Vector<Node *>::iterator>
NodeRange;
typedef std::vector<NodeInput *> NodeInputs;
static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);

View File

@ -53,9 +53,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
/* interface handle for nodes */
NodeConverter converter(this);
for (int index = 0; index < m_graph.nodes().size(); index++) {
Node *node = (Node *)m_graph.nodes()[index];
for (Node *node : m_graph.nodes()) {
m_current_node = node;
DebugInfo::node_to_operations(node);