UI: Cleanup Dialog to Manage Orphaned Data #106653

Merged
Harley Acheson merged 22 commits from Harley/blender:ManageData into main 2024-01-17 01:09:21 +01:00
3 changed files with 23 additions and 11 deletions
Showing only changes of commit 4bb8c60809 - Show all commits

View File

@ -394,7 +394,8 @@ std::unique_ptr<LazyFunction> get_simulation_input_lazy_function(
const bNode &node,
GeometryNodesLazyFunctionGraphInfo &own_lf_graph_info);
std::unique_ptr<LazyFunction> get_switch_node_lazy_function(const bNode &node);
std::unique_ptr<LazyFunction> get_index_switch_node_lazy_function(const bNode &node);
std::unique_ptr<LazyFunction> get_index_switch_node_lazy_function(
const bNode &node, GeometryNodesLazyFunctionGraphInfo &lf_graph_info);
std::unique_ptr<LazyFunction> get_bake_lazy_function(
const bNode &node, GeometryNodesLazyFunctionGraphInfo &own_lf_graph_info);

View File

@ -179,23 +179,32 @@ class LazyFunctionForIndexSwitchNode : public LazyFunction {
const CPPType *field_base_type_;
public:
LazyFunctionForIndexSwitchNode(const bNode &node) : node_(node)
LazyFunctionForIndexSwitchNode(const bNode &node,
GeometryNodesLazyFunctionGraphInfo &lf_graph_info)
: node_(node)
{
const NodeIndexSwitch &storage = node_storage(node);
const eNodeSocketDatatype data_type = eNodeSocketDatatype(storage.data_type);
can_be_field_ = socket_type_supports_fields(data_type);
const bNodeSocket &index_socket = node.input_socket(0);
const bNodeSocket &output_socket = node.output_socket(0);
const CPPType &cpp_type = *output_socket.typeinfo->geometry_nodes_cpp_type;
field_base_type_ = output_socket.typeinfo->base_cpp_type;
debug_name_ = node.name;
inputs_.append_as("Index", CPPType::get<SocketValueVariant>(), lf::ValueUsage::Used);
can_be_field_ = socket_type_supports_fields(data_type);
field_base_type_ = output_socket.typeinfo->base_cpp_type;
MutableSpan<int> lf_index_by_bsocket = lf_graph_info.mapping.lf_index_by_bsocket;
lf_index_by_bsocket[index_socket.index_in_tree()] = inputs_.append_and_get_index_as(
"Index", CPPType::get<SocketValueVariant>(), lf::ValueUsage::Used);
lf_index_by_bsocket[output_socket.index_in_tree()] = outputs_.append_and_get_index_as(
"Value", cpp_type);
for (const int i : storage.items_span().index_range()) {
const bNodeSocket &input = node.input_socket(value_inputs_start + i);
inputs_.append_as(input.identifier, cpp_type, lf::ValueUsage::Maybe);
lf_index_by_bsocket[input.index_in_tree()] = inputs_.append_and_get_index_as(
input.identifier, cpp_type, lf::ValueUsage::Maybe);
}
outputs_.append_as("Value", cpp_type);
}
void execute_impl(lf::Params &params, const lf::Context & /*context*/) const override
@ -342,11 +351,12 @@ NOD_REGISTER_NODE(register_node)
namespace blender::nodes {
std::unique_ptr<LazyFunction> get_index_switch_node_lazy_function(const bNode &node)
std::unique_ptr<LazyFunction> get_index_switch_node_lazy_function(
const bNode &node, GeometryNodesLazyFunctionGraphInfo &lf_graph_info)
{
using namespace node_geo_index_switch_cc;
BLI_assert(node.type == GEO_NODE_INDEX_SWITCH);
return std::make_unique<LazyFunctionForIndexSwitchNode>(node);
return std::make_unique<LazyFunctionForIndexSwitchNode>(node, lf_graph_info);
}
} // namespace blender::nodes

View File

@ -3663,7 +3663,8 @@ struct GeometryNodesLazyFunctionBuilder {
void build_index_switch_node(const bNode &bnode, BuildGraphParams &graph_params)
{
std::unique_ptr<LazyFunction> lazy_function = get_index_switch_node_lazy_function(bnode);
std::unique_ptr<LazyFunction> lazy_function = get_index_switch_node_lazy_function(
bnode, *lf_graph_info_);
lf::FunctionNode &lf_node = graph_params.lf_graph.add_function(*lazy_function);
scope_.add(std::move(lazy_function));