diff options
-rw-r--r-- | source/blender/functions/FN_multi_function_network.hh | 12 | ||||
-rw-r--r-- | source/blender/functions/intern/multi_function_network_evaluation.cc | 21 |
2 files changed, 10 insertions, 23 deletions
diff --git a/source/blender/functions/FN_multi_function_network.hh b/source/blender/functions/FN_multi_function_network.hh index 413f68a8531..01860c540e3 100644 --- a/source/blender/functions/FN_multi_function_network.hh +++ b/source/blender/functions/FN_multi_function_network.hh @@ -95,8 +95,6 @@ class MFNode : NonCopyable, NonMovable { Span<MFOutputSocket *> outputs(); Span<const MFOutputSocket *> outputs() const; - template<typename FuncT> void foreach_origin_socket(const FuncT &func) const; - bool all_inputs_have_origin() const; private: @@ -333,16 +331,6 @@ inline Span<const MFOutputSocket *> MFNode::outputs() const return outputs_; } -template<typename FuncT> inline void MFNode::foreach_origin_socket(const FuncT &func) const -{ - for (const MFInputSocket *socket : inputs_) { - const MFOutputSocket *origin = socket->origin(); - if (origin != nullptr) { - func(*origin); - } - } -} - inline bool MFNode::all_inputs_have_origin() const { for (const MFInputSocket *socket : inputs_) { diff --git a/source/blender/functions/intern/multi_function_network_evaluation.cc b/source/blender/functions/intern/multi_function_network_evaluation.cc index 36d363dc56c..b4dce040da6 100644 --- a/source/blender/functions/intern/multi_function_network_evaluation.cc +++ b/source/blender/functions/intern/multi_function_network_evaluation.cc @@ -219,8 +219,6 @@ BLI_NOINLINE void MFNetworkEvaluator::evaluate_network_to_compute_outputs( sockets_to_compute.push(socket->origin()); } - Vector<const MFOutputSocket *, 32> missing_sockets; - /* This is the main loop that traverses the MFNetwork. */ while (!sockets_to_compute.is_empty()) { const MFOutputSocket &socket = *sockets_to_compute.peek(); @@ -235,17 +233,18 @@ BLI_NOINLINE void MFNetworkEvaluator::evaluate_network_to_compute_outputs( BLI_assert(node.all_inputs_have_origin()); const MFFunctionNode &function_node = node.as_function(); - missing_sockets.clear(); - function_node.foreach_origin_socket([&](const MFOutputSocket &origin) { - if (!storage.socket_is_computed(origin)) { - missing_sockets.append(&origin); + bool all_origins_are_computed = true; + for (const MFInputSocket *input_socket : function_node.inputs()) { + const MFOutputSocket *origin = input_socket->origin(); + if (origin != nullptr) { + if (!storage.socket_is_computed(*origin)) { + sockets_to_compute.push(origin); + all_origins_are_computed = false; + } } - }); - - sockets_to_compute.push_multiple(missing_sockets); + } - bool all_inputs_are_computed = missing_sockets.size() == 0; - if (all_inputs_are_computed) { + if (all_origins_are_computed) { this->evaluate_function(global_context, function_node, storage); sockets_to_compute.pop(); } |