diff options
Diffstat (limited to 'source/blender/blenkernel/intern/node_tree_ref.cc')
-rw-r--r-- | source/blender/blenkernel/intern/node_tree_ref.cc | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/node_tree_ref.cc b/source/blender/blenkernel/intern/node_tree_ref.cc index 6bd3e2d2e5a..1803243d4cc 100644 --- a/source/blender/blenkernel/intern/node_tree_ref.cc +++ b/source/blender/blenkernel/intern/node_tree_ref.cc @@ -21,40 +21,40 @@ namespace blender { namespace bke { -NodeTreeRef::NodeTreeRef(bNodeTree *btree) : m_btree(btree) +NodeTreeRef::NodeTreeRef(bNodeTree *btree) : btree_(btree) { Map<bNode *, NodeRef *> node_mapping; LISTBASE_FOREACH (bNode *, bnode, &btree->nodes) { - NodeRef &node = *m_allocator.construct<NodeRef>(); + NodeRef &node = *allocator_.construct<NodeRef>(); - node.m_tree = this; - node.m_bnode = bnode; - node.m_id = m_nodes_by_id.append_and_get_index(&node); - RNA_pointer_create(&btree->id, &RNA_Node, bnode, &node.m_rna); + node.tree_ = this; + node.bnode_ = bnode; + node.id_ = nodes_by_id_.append_and_get_index(&node); + RNA_pointer_create(&btree->id, &RNA_Node, bnode, &node.rna_); LISTBASE_FOREACH (bNodeSocket *, bsocket, &bnode->inputs) { - InputSocketRef &socket = *m_allocator.construct<InputSocketRef>(); - socket.m_node = &node; - socket.m_index = node.m_inputs.append_and_get_index(&socket); - socket.m_is_input = true; - socket.m_bsocket = bsocket; - socket.m_id = m_sockets_by_id.append_and_get_index(&socket); - RNA_pointer_create(&btree->id, &RNA_NodeSocket, bsocket, &socket.m_rna); + InputSocketRef &socket = *allocator_.construct<InputSocketRef>(); + socket.node_ = &node; + socket.index_ = node.inputs_.append_and_get_index(&socket); + socket.is_input_ = true; + socket.bsocket_ = bsocket; + socket.id_ = sockets_by_id_.append_and_get_index(&socket); + RNA_pointer_create(&btree->id, &RNA_NodeSocket, bsocket, &socket.rna_); } LISTBASE_FOREACH (bNodeSocket *, bsocket, &bnode->outputs) { - OutputSocketRef &socket = *m_allocator.construct<OutputSocketRef>(); - socket.m_node = &node; - socket.m_index = node.m_outputs.append_and_get_index(&socket); - socket.m_is_input = false; - socket.m_bsocket = bsocket; - socket.m_id = m_sockets_by_id.append_and_get_index(&socket); - RNA_pointer_create(&btree->id, &RNA_NodeSocket, bsocket, &socket.m_rna); + OutputSocketRef &socket = *allocator_.construct<OutputSocketRef>(); + socket.node_ = &node; + socket.index_ = node.outputs_.append_and_get_index(&socket); + socket.is_input_ = false; + socket.bsocket_ = bsocket; + socket.id_ = sockets_by_id_.append_and_get_index(&socket); + RNA_pointer_create(&btree->id, &RNA_NodeSocket, bsocket, &socket.rna_); } - m_input_sockets.extend(node.m_inputs); - m_output_sockets.extend(node.m_outputs); + input_sockets_.extend(node.inputs_); + output_sockets_.extend(node.outputs_); node_mapping.add_new(bnode, &node); } @@ -65,34 +65,34 @@ NodeTreeRef::NodeTreeRef(bNodeTree *btree) : m_btree(btree) InputSocketRef &to_socket = this->find_input_socket( node_mapping, blink->tonode, blink->tosock); - from_socket.m_directly_linked_sockets.append(&to_socket); - to_socket.m_directly_linked_sockets.append(&from_socket); + from_socket.directly_linked_sockets_.append(&to_socket); + to_socket.directly_linked_sockets_.append(&from_socket); } - for (OutputSocketRef *socket : m_output_sockets) { - if (!socket->m_node->is_reroute_node()) { - this->find_targets_skipping_reroutes(*socket, socket->m_linked_sockets); - for (SocketRef *target : socket->m_linked_sockets) { - target->m_linked_sockets.append(socket); + for (OutputSocketRef *socket : output_sockets_) { + if (!socket->node_->is_reroute_node()) { + this->find_targets_skipping_reroutes(*socket, socket->linked_sockets_); + for (SocketRef *target : socket->linked_sockets_) { + target->linked_sockets_.append(socket); } } } - for (NodeRef *node : m_nodes_by_id) { - const bNodeType *nodetype = node->m_bnode->typeinfo; - m_nodes_by_type.lookup_or_add_default(nodetype).append(node); + for (NodeRef *node : nodes_by_id_) { + const bNodeType *nodetype = node->bnode_->typeinfo; + nodes_by_type_.lookup_or_add_default(nodetype).append(node); } } NodeTreeRef::~NodeTreeRef() { - for (NodeRef *node : m_nodes_by_id) { + for (NodeRef *node : nodes_by_id_) { node->~NodeRef(); } - for (InputSocketRef *socket : m_input_sockets) { + for (InputSocketRef *socket : input_sockets_) { socket->~InputSocketRef(); } - for (OutputSocketRef *socket : m_output_sockets) { + for (OutputSocketRef *socket : output_sockets_) { socket->~OutputSocketRef(); } } @@ -102,13 +102,13 @@ InputSocketRef &NodeTreeRef::find_input_socket(Map<bNode *, NodeRef *> &node_map bNodeSocket *bsocket) { NodeRef *node = node_mapping.lookup(bnode); - for (SocketRef *socket : node->m_inputs) { - if (socket->m_bsocket == bsocket) { + for (SocketRef *socket : node->inputs_) { + if (socket->bsocket_ == bsocket) { return *(InputSocketRef *)socket; } } BLI_assert(false); - return *node->m_inputs[0]; + return *node->inputs_[0]; } OutputSocketRef &NodeTreeRef::find_output_socket(Map<bNode *, NodeRef *> &node_mapping, @@ -116,21 +116,21 @@ OutputSocketRef &NodeTreeRef::find_output_socket(Map<bNode *, NodeRef *> &node_m bNodeSocket *bsocket) { NodeRef *node = node_mapping.lookup(bnode); - for (SocketRef *socket : node->m_outputs) { - if (socket->m_bsocket == bsocket) { + for (SocketRef *socket : node->outputs_) { + if (socket->bsocket_ == bsocket) { return *(OutputSocketRef *)socket; } } BLI_assert(false); - return *node->m_outputs[0]; + return *node->outputs_[0]; } void NodeTreeRef::find_targets_skipping_reroutes(OutputSocketRef &socket, Vector<SocketRef *> &r_targets) { - for (SocketRef *direct_target : socket.m_directly_linked_sockets) { - if (direct_target->m_node->is_reroute_node()) { - this->find_targets_skipping_reroutes(*direct_target->m_node->m_outputs[0], r_targets); + for (SocketRef *direct_target : socket.directly_linked_sockets_) { + if (direct_target->node_->is_reroute_node()) { + this->find_targets_skipping_reroutes(*direct_target->node_->outputs_[0], r_targets); } else { r_targets.append_non_duplicates(direct_target); @@ -145,7 +145,7 @@ std::string NodeTreeRef::to_dot() const Map<const NodeRef *, dot::NodeWithSocketsRef> dot_nodes; - for (const NodeRef *node : m_nodes_by_id) { + for (const NodeRef *node : nodes_by_id_) { dot::Node &dot_node = digraph.new_node(""); dot_node.set_background_color("white"); @@ -162,7 +162,7 @@ std::string NodeTreeRef::to_dot() const dot::NodeWithSocketsRef(dot_node, node->name(), input_names, output_names)); } - for (const OutputSocketRef *from_socket : m_output_sockets) { + for (const OutputSocketRef *from_socket : output_sockets_) { for (const InputSocketRef *to_socket : from_socket->directly_linked_sockets()) { dot::NodeWithSocketsRef &from_dot_node = dot_nodes.lookup(&from_socket->node()); dot::NodeWithSocketsRef &to_dot_node = dot_nodes.lookup(&to_socket->node()); |