[Bf-blender-cvs] [fb3e05ff627] functions: better usage of wrapper
Jacques Lucke
noreply at git.blender.org
Mon Feb 11 18:30:27 CET 2019
Commit: fb3e05ff6278ad99dc1a3410212694f164edb9c3
Author: Jacques Lucke
Date: Mon Feb 11 16:57:36 2019 +0100
Branches: functions
https://developer.blender.org/rBfb3e05ff6278ad99dc1a3410212694f164edb9c3
better usage of wrapper
===================================================================
M source/blender/functions/function_nodes/function_nodes.cpp
M source/blender/functions/function_nodes/function_nodes.hpp
===================================================================
diff --git a/source/blender/functions/function_nodes/function_nodes.cpp b/source/blender/functions/function_nodes/function_nodes.cpp
index 0f511b8e018..50916eeceab 100644
--- a/source/blender/functions/function_nodes/function_nodes.cpp
+++ b/source/blender/functions/function_nodes/function_nodes.cpp
@@ -1,17 +1,12 @@
#include "function_nodes.hpp"
#include "BLI_listbase.h"
-#include "BLI_listbase_wrapper.hpp"
#include "BKE_node.h"
#include "BKE_idprop.h"
namespace FN::FunctionNodes {
- using bNodeList = ListBaseWrapper<bNode, true>;
- using bLinkList = ListBaseWrapper<bNodeLink, true>;
- using bSocketList = ListBaseWrapper<bNodeSocket, true>;
-
using SocketMap = SmallMap<bNodeSocket *, Socket>;
typedef void (*InsertInGraphFunction)(
SharedDataFlowGraph &graph,
@@ -243,7 +238,7 @@ namespace FN::FunctionNodes {
SmallSocketVector input_sockets;
SmallSocketVector output_sockets;
- for (bNode *bnode : bNodeList(&m_tree->nodes)) {
+ for (bNode *bnode : this->nodes()) {
auto insert = inserters.lookup(bnode->idname);
insert(graph, socket_map, bnode);
@@ -261,13 +256,13 @@ namespace FN::FunctionNodes {
}
}
- for (bNodeLink *blink : bLinkList(&m_tree->links)) {
+ for (bNodeLink *blink : this->links()) {
Socket from = socket_map.lookup(blink->fromsock);
Socket to = socket_map.lookup(blink->tosock);
graph->link(from, to);
}
- for (bNode *bnode : bNodeList(&m_tree->nodes)) {
+ for (bNode *bnode : this->nodes()) {
for (bNodeSocket *bsocket : bSocketList(&bnode->inputs)) {
Socket socket = socket_map.lookup(bsocket);
if (!socket.is_linked()) {
diff --git a/source/blender/functions/function_nodes/function_nodes.hpp b/source/blender/functions/function_nodes/function_nodes.hpp
index 3e456c4f859..e671b072330 100644
--- a/source/blender/functions/function_nodes/function_nodes.hpp
+++ b/source/blender/functions/function_nodes/function_nodes.hpp
@@ -1,8 +1,13 @@
#include "FN_functions.hpp"
#include "DNA_node_types.h"
+#include "BLI_listbase_wrapper.hpp"
namespace FN::FunctionNodes {
+ using bNodeList = ListBaseWrapper<bNode, true>;
+ using bLinkList = ListBaseWrapper<bNodeLink, true>;
+ using bSocketList = ListBaseWrapper<bNodeSocket, true>;
+
class FunctionNodeTree {
private:
bNodeTree *m_tree;
@@ -11,6 +16,16 @@ namespace FN::FunctionNodes {
FunctionNodeTree(bNodeTree *tree)
: m_tree(tree) {}
+ bNodeList nodes() const
+ {
+ return bNodeList(&m_tree->nodes);
+ }
+
+ bLinkList links() const
+ {
+ return bLinkList(&m_tree->links);
+ }
+
FunctionGraph to_function_graph() const;
};
More information about the Bf-blender-cvs
mailing list