[Bf-blender-cvs] [2f3ccb7e906] functions: move all tree mappings into folder

Jacques Lucke noreply at git.blender.org
Fri Aug 2 19:14:58 CEST 2019


Commit: 2f3ccb7e906a30a1ac96abf23b213cd435a3d155
Author: Jacques Lucke
Date:   Fri Aug 2 14:00:46 2019 +0200
Branches: functions
https://developer.blender.org/rB2f3ccb7e906a30a1ac96abf23b213cd435a3d155

move all tree mappings into folder

===================================================================

M	source/blender/functions/CMakeLists.txt
M	source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
M	source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp
R098	source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp	source/blender/functions/frontends/data_flow_nodes/mappings/conversions.cpp
A	source/blender/functions/frontends/data_flow_nodes/mappings/mappings.hpp
R099	source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp	source/blender/functions/frontends/data_flow_nodes/mappings/nodes.cpp
R085	source/blender/functions/frontends/data_flow_nodes/inserters.cpp	source/blender/functions/frontends/data_flow_nodes/mappings/registry.cpp
R067	source/blender/functions/frontends/data_flow_nodes/inserters.hpp	source/blender/functions/frontends/data_flow_nodes/mappings/registry.hpp
R098	source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp	source/blender/functions/frontends/data_flow_nodes/mappings/sockets.cpp
R098	source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp	source/blender/functions/frontends/data_flow_nodes/mappings/type_mappings.cpp
D	source/blender/functions/frontends/data_flow_nodes/registry.hpp
D	source/blender/functions/frontends/data_flow_nodes/type_mappings.hpp
M	source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp

===================================================================

diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt
index 6ec6c000303..f61d1738cff 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -145,14 +145,13 @@ set(SRC
   frontends/data_flow_nodes/function_generation.cpp
   frontends/data_flow_nodes/graph_generation.hpp
   frontends/data_flow_nodes/graph_generation.cpp
-  frontends/data_flow_nodes/inserters.hpp
-  frontends/data_flow_nodes/inserters.cpp
-  frontends/data_flow_nodes/registry.hpp
-  frontends/data_flow_nodes/inserters/nodes.cpp
-  frontends/data_flow_nodes/inserters/sockets.cpp
-  frontends/data_flow_nodes/inserters/conversions.cpp
-  frontends/data_flow_nodes/type_mappings.hpp
-  frontends/data_flow_nodes/type_mappings.cpp
+  frontends/data_flow_nodes/mappings/mappings.hpp
+  frontends/data_flow_nodes/mappings/registry.hpp
+  frontends/data_flow_nodes/mappings/registry.cpp
+  frontends/data_flow_nodes/mappings/nodes.cpp
+  frontends/data_flow_nodes/mappings/sockets.cpp
+  frontends/data_flow_nodes/mappings/conversions.cpp
+  frontends/data_flow_nodes/mappings/type_mappings.cpp
   frontends/data_flow_nodes/vtree_data_graph.hpp
   frontends/data_flow_nodes/vtree_data_graph.cpp
   frontends/data_flow_nodes/input_handlers.hpp
diff --git a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
index 13a04fbd01f..2ce843b7b06 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
@@ -2,7 +2,7 @@
 
 #include "FN_data_flow_nodes.hpp"
 
-#include "inserters.hpp"
+#include "mappings/mappings.hpp"
 
 namespace FN {
 namespace DataFlowNodes {
diff --git a/source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp b/source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp
index 5023fcadf9d..b74edb96bb1 100644
--- a/source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp
@@ -3,7 +3,7 @@
 #include "FN_dependencies.hpp"
 #include "FN_data_flow_nodes.hpp"
 
-#include "inserters.hpp"
+#include "mappings/mappings.hpp"
 
 namespace FN {
 namespace DataFlowNodes {
diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp b/source/blender/functions/frontends/data_flow_nodes/mappings/conversions.cpp
similarity index 98%
rename from source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/conversions.cpp
index 54dcf125f8b..aaa18b515a1 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/conversions.cpp
@@ -1,4 +1,4 @@
-#include "../registry.hpp"
+#include "registry.hpp"
 
 #include "FN_functions.hpp"
 
diff --git a/source/blender/functions/frontends/data_flow_nodes/mappings/mappings.hpp b/source/blender/functions/frontends/data_flow_nodes/mappings/mappings.hpp
new file mode 100644
index 00000000000..315ecc86ca4
--- /dev/null
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/mappings.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#include <functional>
+
+#include "BLI_string_map.hpp"
+#include "FN_tuple_call.hpp"
+
+#include "../vtree_data_graph_builder.hpp"
+
+namespace FN {
+namespace DataFlowNodes {
+
+using BLI::StringMap;
+using StringPair = std::pair<std::string, std::string>;
+
+typedef std::function<void(VTreeDataGraphBuilder &builder, VirtualNode *vnode)> NodeInserter;
+
+typedef std::function<void(PointerRNA *socket_rna_ptr, Tuple &dst, uint index)> SocketLoader;
+
+typedef std::function<void(
+    VTreeDataGraphBuilder &builder, BuilderOutputSocket *from, BuilderInputSocket *to)>
+    ConversionInserter;
+
+StringMap<SharedType> &get_type_by_idname_map();
+StringMap<SharedType> &get_type_by_data_type_map();
+StringMap<std::string> &get_data_type_by_idname_map();
+StringMap<std::string> &get_idname_by_data_type_map();
+
+StringMap<NodeInserter> &get_node_inserters_map();
+StringMap<SocketLoader> &get_socket_loader_map();
+Map<StringPair, ConversionInserter> &get_conversion_inserter_map();
+
+}  // namespace DataFlowNodes
+}  // namespace FN
+
+namespace std {
+template<> struct hash<FN::DataFlowNodes::StringPair> {
+  typedef FN::DataFlowNodes::StringPair argument_type;
+  typedef size_t result_type;
+
+  result_type operator()(argument_type const &v) const noexcept
+  {
+    size_t h1 = std::hash<std::string>{}(v.first);
+    size_t h2 = std::hash<std::string>{}(v.second);
+    return h1 ^ h2;
+  }
+};
+}  // namespace std
diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp b/source/blender/functions/frontends/data_flow_nodes/mappings/nodes.cpp
similarity index 99%
rename from source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/nodes.cpp
index 891e738dff7..f74bafef409 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/nodes.cpp
@@ -1,5 +1,3 @@
-#include "../registry.hpp"
-
 #include "FN_functions.hpp"
 #include "FN_types.hpp"
 #include "FN_data_flow_nodes.hpp"
@@ -8,6 +6,8 @@
 
 #include "DNA_node_types.h"
 
+#include "registry.hpp"
+
 namespace FN {
 namespace DataFlowNodes {
 
diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters.cpp b/source/blender/functions/frontends/data_flow_nodes/mappings/registry.cpp
similarity index 85%
rename from source/blender/functions/frontends/data_flow_nodes/inserters.cpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/registry.cpp
index 8d276e53983..96fc0f821c1 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/registry.cpp
@@ -1,14 +1,6 @@
-#include "inserters.hpp"
-#include "registry.hpp"
-#include "type_mappings.hpp"
-
-#include "FN_dependencies.hpp"
-
 #include "BLI_lazy_init.hpp"
 
-#include "DNA_node_types.h"
-
-#include "RNA_access.h"
+#include "registry.hpp"
 
 namespace FN {
 namespace DataFlowNodes {
diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp b/source/blender/functions/frontends/data_flow_nodes/mappings/registry.hpp
similarity index 67%
rename from source/blender/functions/frontends/data_flow_nodes/inserters.hpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/registry.hpp
index 2b4d3050aaf..fd0cd703aac 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/registry.hpp
@@ -1,35 +1,14 @@
 #pragma once
 
-#include <functional>
-
-#include "BLI_optional.hpp"
-#include "BLI_string_map.hpp"
-#include "FN_tuple_call.hpp"
-
-#include "vtree_data_graph_builder.hpp"
-#include "type_mappings.hpp"
+#include "mappings.hpp"
 
 struct PointerRNA;
 
 namespace FN {
 namespace DataFlowNodes {
 
-using StringPair = std::pair<std::string, std::string>;
-
-typedef std::function<void(VTreeDataGraphBuilder &builder, VirtualNode *vnode)> NodeInserter;
-
-typedef std::function<void(PointerRNA *socket_rna_ptr, Tuple &dst, uint index)> SocketLoader;
-
-typedef std::function<void(
-    VTreeDataGraphBuilder &builder, BuilderOutputSocket *from, BuilderInputSocket *to)>
-    ConversionInserter;
-
 typedef std::function<SharedFunction()> FunctionGetter;
 
-StringMap<NodeInserter> &get_node_inserters_map();
-StringMap<SocketLoader> &get_socket_loader_map();
-Map<StringPair, ConversionInserter> &get_conversion_inserter_map();
-
 class NodeInserterRegistry {
  private:
   StringMap<NodeInserter> &m_map;
@@ -103,19 +82,9 @@ class ConversionInserterRegistry {
   }
 };
 
+void register_socket_loaders(SocketLoaderRegistry &registry);
+void register_node_inserters(NodeInserterRegistry &registry);
+void register_conversion_inserters(ConversionInserterRegistry &registry);
+
 }  // namespace DataFlowNodes
 }  // namespace FN
-
-namespace std {
-template<> struct hash<FN::DataFlowNodes::StringPair> {
-  typedef FN::DataFlowNodes::StringPair argument_type;
-  typedef size_t result_type;
-
-  result_type operator()(argument_type const &v) const noexcept
-  {
-    size_t h1 = std::hash<std::string>{}(v.first);
-    size_t h2 = std::hash<std::string>{}(v.second);
-    return h1 ^ h2;
-  }
-};
-}  // namespace std
diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp b/source/blender/functions/frontends/data_flow_nodes/mappings/sockets.cpp
similarity index 98%
rename from source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/sockets.cpp
index fddc382bf83..f330ad160fc 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/sockets.cpp
@@ -1,4 +1,4 @@
-#include "../registry.hpp"
+#include "registry.hpp"
 
 #include "FN_types.hpp"
 #include "FN_functions.hpp"
diff --git a/source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp b/source/blender/functions/frontends/data_flow_nodes/mappings/type_mappings.cpp
similarity index 98%
rename from source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp
rename to source/blender/functions/frontends/data_flow_nodes/mappings/type_mappings.cpp
index 8ba2cae82e9..e020ab484fe 100644
--- a/source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/mappings/type_mappings.cpp
@@ -1,8 +1,7 @@
 #include "BLI_lazy_init.hpp"
-
 #include "FN_types.hpp"
 
-#include "type_mappings.hpp"
+#include "registry.hpp"
 
 namespace FN {
 namespace DataFlowNodes {
diff --git a/source/blender/functions/frontends/data_flow_nodes/registry.hpp b/source/blender/functions/frontends/data_flow_nodes/registry.hpp
deleted file mode 100644
index 4c3ec11f02a..00000000000
--- a/sou

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list