Files
test/source/blender/nodes/NOD_geometry_nodes_closure_eval.hh
Jacques Lucke f50699d80a Refactor: Geometry Nodes: use a single string identifier for closure/bundle items
Previously, we used `SocketInterfaceKey` as identifier for bundle and closure
items. It contained multiple identifiers (although only one was ever used so
far). The idea was that multiple identifiers could provide more flexibility.
E.g. an Evaluate Closure node could work with closures with slightly different
identifier names, or a bundle could be passed into different systems that expect
the same data but named differently.

The added complexity by allowing for this is greater than I anticipated even
though most places didn't even support multiple identifiers yet. In addition to
that, it seems like there may be simpler workaround for many situations where
multiple identifiers were supposed to help. E.g. one could just add the same
value to a bundle twice with different names or one can build a node group that
maps a bundle for one system to one for another system.

Overall, the complexity of `SocketInterfaceKey` didn't seem worth it, and we can
probably just build a better system when we don't allow multiple identifiers per
item.

Pull Request: https://projects.blender.org/blender/blender/pulls/142947
2025-07-23 21:26:51 +02:00

42 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2025 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "NOD_geometry_nodes_closure.hh"
#include "NOD_geometry_nodes_lazy_function.hh"
namespace blender::nodes {
struct ClosureEagerEvalParams {
struct InputItem {
std::string key;
const bke::bNodeSocketType *type = nullptr;
/**
* The actual socket value of type bNodeSocketType::geometry_nodes_cpp_type.
* This is not const, because it may be moved from.
*/
void *value = nullptr;
};
struct OutputItem {
std::string key;
const bke::bNodeSocketType *type = nullptr;
/**
* Where the output value should be stored. This is expected to point to uninitialized memory
* when it's passed into #evaluate_closure_eagerly which will then construct the value inplace.
*/
void *value = nullptr;
};
Vector<InputItem> inputs;
Vector<OutputItem> outputs;
GeoNodesUserData *user_data = nullptr;
};
void evaluate_closure_eagerly(const Closure &closure, ClosureEagerEvalParams &params);
} // namespace blender::nodes