[Bf-blender-cvs] [1aa827d496a] functions: extract method that ensures required inputs

Jacques Lucke noreply at git.blender.org
Sun Apr 28 21:16:01 CEST 2019


Commit: 1aa827d496a6542589badf484065e15e7deb5bf8
Author: Jacques Lucke
Date:   Sun Apr 28 19:23:59 2019 +0200
Branches: functions
https://developer.blender.org/rB1aa827d496a6542589badf484065e15e7deb5bf8

extract method that ensures required inputs

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

M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

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

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 3bfaeb13215..e1ef711d0c4 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -297,16 +297,8 @@ class ExecuteFGraph : public TupleCallBody {
             LazyInTupleCallBody *body = (LazyInTupleCallBody *)m_node_info[node_id].body;
 
             if (lazy_states.empty() || lazy_states.peek().node_id != node_id) {
-
-              bool required_inputs_computed = true;
-
-              for (uint input_index : body->always_required()) {
-                uint input_id = m_graph->id_of_node_input(node_id, input_index);
-                if (!storage.is_input_initialized(input_id)) {
-                  sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-                  required_inputs_computed = false;
-                }
-              }
+              bool required_inputs_computed = this->ensure_required_inputs(
+                  body, node_id, storage, sockets_to_compute);
 
               if (required_inputs_computed) {
                 void *user_data = alloca(body->user_data_size());
@@ -381,6 +373,22 @@ class ExecuteFGraph : public TupleCallBody {
     }
   }
 
+  bool ensure_required_inputs(LazyInTupleCallBody *body,
+                              uint node_id,
+                              SocketValueStorage &storage,
+                              SocketsToComputeStack &sockets_to_compute) const
+  {
+    bool required_inputs_computed = true;
+    for (uint input_index : body->always_required()) {
+      uint input_id = m_graph->id_of_node_input(node_id, input_index);
+      if (!storage.is_input_initialized(input_id)) {
+        sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
+        required_inputs_computed = false;
+      }
+    }
+    return required_inputs_computed;
+  }
+
   void push_requested_inputs_to_stack(LazyState &state,
                                       uint node_id,
                                       SocketValueStorage &storage,



More information about the Bf-blender-cvs mailing list