[Bf-blender-cvs] [f16e64435fc] functions: deduplicate some code

Jacques Lucke noreply at git.blender.org
Sun Apr 28 21:15:56 CEST 2019


Commit: f16e64435fcee4e48f0824152768744297ee2284
Author: Jacques Lucke
Date:   Sun Apr 28 19:15:57 2019 +0200
Branches: functions
https://developer.blender.org/rBf16e64435fcee4e48f0824152768744297ee2284

deduplicate some code

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

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 d10f5d7235e..5bbe7a9f444 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -326,12 +326,8 @@ class ExecuteFGraph : public TupleCallBody {
                   sockets_to_compute.pop();
                 }
                 else {
-                  for (uint requested_input_index : state.requested_inputs()) {
-                    uint input_id = m_graph->id_of_node_input(node_id, requested_input_index);
-                    if (!storage.is_input_initialized(input_id)) {
-                      sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-                    }
-                  }
+                  this->push_requested_inputs_to_stack(
+                      state, node_id, storage, sockets_to_compute);
                   lazy_states.push(LazyStateOfNode(node_id, state));
                 }
               }
@@ -354,12 +350,7 @@ class ExecuteFGraph : public TupleCallBody {
                 lazy_states.pop();
               }
               else {
-                for (uint requested_input_index : state.requested_inputs()) {
-                  uint input_id = m_graph->id_of_node_input(node_id, requested_input_index);
-                  if (!storage.is_input_initialized(input_id)) {
-                    sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-                  }
-                }
+                this->push_requested_inputs_to_stack(state, node_id, storage, sockets_to_compute);
               }
             }
           }
@@ -394,6 +385,19 @@ class ExecuteFGraph : public TupleCallBody {
     }
   }
 
+  void push_requested_inputs_to_stack(LazyState &state,
+                                      uint node_id,
+                                      SocketValueStorage &storage,
+                                      SocketsToComputeStack &sockets_to_compute) const
+  {
+    for (uint requested_input_index : state.requested_inputs()) {
+      uint input_id = m_graph->id_of_node_input(node_id, requested_input_index);
+      if (!storage.is_input_initialized(input_id)) {
+        sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
+      }
+    }
+  }
+
   void copy_outputs_to_final_output_if_necessary(uint node_id,
                                                  SocketValueStorage &storage,
                                                  Tuple &fn_out) const



More information about the Bf-blender-cvs mailing list