[Bf-blender-cvs] [17dd4e03b87] functions: move function generation file to correct file
Jacques Lucke
noreply at git.blender.org
Tue Jul 23 19:17:01 CEST 2019
Commit: 17dd4e03b87cdc749bb5788bf8585314555ff99b
Author: Jacques Lucke
Date: Tue Jul 23 18:04:27 2019 +0200
Branches: functions
https://developer.blender.org/rB17dd4e03b87cdc749bb5788bf8585314555ff99b
move function generation file to correct file
===================================================================
M source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
M source/blender/functions/frontends/data_flow_nodes/function_generation.hpp
M source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
M source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp
===================================================================
diff --git a/source/blender/functions/frontends/data_flow_nodes/function_generation.cpp b/source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
index 3cf58789949..3a377af43b7 100644
--- a/source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
@@ -9,6 +9,45 @@
namespace FN {
namespace DataFlowNodes {
+static void find_interface_sockets(VirtualNodeTree &vtree,
+ BTreeDataGraph &graph,
+ DFGraphSocketSetVector &r_inputs,
+ DFGraphSocketSetVector &r_outputs)
+{
+ VirtualNode *input_node = vtree.nodes_with_idname("fn_FunctionInputNode").get(0, nullptr);
+ VirtualNode *output_node = vtree.nodes_with_idname("fn_FunctionOutputNode").get(0, nullptr);
+
+ if (input_node != nullptr) {
+ for (uint i = 0; i < input_node->outputs().size() - 1; i++) {
+ VirtualSocket *vsocket = input_node->output(i);
+ r_inputs.add_new(graph.lookup_socket(vsocket));
+ }
+ }
+
+ if (output_node != nullptr) {
+ for (uint i = 0; i < output_node->inputs().size() - 1; i++) {
+ VirtualSocket *vsocket = output_node->input(i);
+ r_outputs.add_new(graph.lookup_socket(vsocket));
+ }
+ }
+}
+
+static Optional<FunctionGraph> generate_function_graph(VirtualNodeTree &vtree)
+{
+ Optional<BTreeDataGraph> data_graph_ = generate_graph(vtree);
+ if (!data_graph_.has_value()) {
+ return {};
+ }
+
+ BTreeDataGraph &data_graph = data_graph_.value();
+
+ DFGraphSocketSetVector input_sockets;
+ DFGraphSocketSetVector output_sockets;
+ find_interface_sockets(vtree, data_graph, input_sockets, output_sockets);
+
+ return FunctionGraph(data_graph.graph(), input_sockets, output_sockets);
+}
+
Optional<SharedFunction> generate_function(bNodeTree *btree)
{
VirtualNodeTree vtree;
diff --git a/source/blender/functions/frontends/data_flow_nodes/function_generation.hpp b/source/blender/functions/frontends/data_flow_nodes/function_generation.hpp
index dd5e2201115..b0b402f2094 100644
--- a/source/blender/functions/frontends/data_flow_nodes/function_generation.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/function_generation.hpp
@@ -9,5 +9,6 @@ namespace FN {
namespace DataFlowNodes {
Optional<SharedFunction> generate_function(struct bNodeTree *btree);
-}
+
+} // namespace DataFlowNodes
} // namespace FN
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 fb739dfceb0..5bd7129e65f 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
@@ -89,29 +89,6 @@ static void insert_unlinked_inputs(BTreeGraphBuilder &builder,
}
}
-static void find_interface_sockets(VirtualNodeTree &vtree,
- BTreeDataGraph &graph,
- DFGraphSocketSetVector &r_inputs,
- DFGraphSocketSetVector &r_outputs)
-{
- VirtualNode *input_node = vtree.nodes_with_idname("fn_FunctionInputNode").get(0, nullptr);
- VirtualNode *output_node = vtree.nodes_with_idname("fn_FunctionOutputNode").get(0, nullptr);
-
- if (input_node != nullptr) {
- for (uint i = 0; i < input_node->outputs().size() - 1; i++) {
- VirtualSocket *vsocket = input_node->output(i);
- r_inputs.add_new(graph.lookup_socket(vsocket));
- }
- }
-
- if (output_node != nullptr) {
- for (uint i = 0; i < output_node->inputs().size() - 1; i++) {
- VirtualSocket *vsocket = output_node->input(i);
- r_outputs.add_new(graph.lookup_socket(vsocket));
- }
- }
-}
-
static Map<VirtualSocket *, DFGraphSocket> build_mapping_for_original_sockets(
Map<VirtualSocket *, DFGB_Socket> &socket_map,
DataFlowGraph::ToBuilderMapping &builder_mapping)
@@ -167,21 +144,5 @@ Optional<BTreeDataGraph> generate_graph(VirtualNodeTree &vtree)
build_mapping_for_original_sockets(socket_map, build_result.mapping));
}
-Optional<FunctionGraph> generate_function_graph(VirtualNodeTree &vtree)
-{
- Optional<BTreeDataGraph> data_graph_ = generate_graph(vtree);
- if (!data_graph_.has_value()) {
- return {};
- }
-
- BTreeDataGraph &data_graph = data_graph_.value();
-
- DFGraphSocketSetVector input_sockets;
- DFGraphSocketSetVector output_sockets;
- find_interface_sockets(vtree, data_graph, input_sockets, output_sockets);
-
- return FunctionGraph(data_graph.graph(), input_sockets, output_sockets);
-}
-
} // namespace DataFlowNodes
} // namespace FN
diff --git a/source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp b/source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp
index 6faccd32b94..97c1a5f1504 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp
@@ -49,7 +49,5 @@ class BTreeDataGraph {
Optional<BTreeDataGraph> generate_graph(VirtualNodeTree &vtree);
-Optional<FunctionGraph> generate_function_graph(VirtualNodeTree &vtree);
-
} // namespace DataFlowNodes
} // namespace FN
More information about the Bf-blender-cvs
mailing list