WIP: Closures and deferred evaluation for geometry nodes #107842

Draft
Lukas Tönne wants to merge 35 commits from LukasTonne/blender:geometry-nodes-closures into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 8 additions and 8 deletions
Showing only changes of commit d4759b1503 - Show all commits

View File

@ -58,9 +58,9 @@ static void node_geo_exec(GeoNodeExecParams params)
}
const bNodeTree &bind_tree = *reinterpret_cast<bNodeTree *>(params.node().id);
const std::unique_ptr<GeometryNodesLazyFunctionGraphInfo> &lf_graph_info_ptr =
bind_tree.runtime->geometry_nodes_lazy_function_graph_info;
BLI_assert(lf_graph_info_ptr);
const GeometryNodesLazyFunctionGraphInfo *lf_graph_info =
ensure_geometry_nodes_lazy_function_graph(bind_tree);
BLI_assert(lf_graph_info);
Array<GMutablePointer> bound_values(params.node().input_sockets().size());
for (const int i : params.node().input_sockets().index_range()) {
@ -94,7 +94,7 @@ static void node_geo_exec(GeoNodeExecParams params)
bound_values[i] = {cpptype, bound_value_buffer};
}
Closure closure(*lf_graph_info_ptr, bound_values);
Closure closure(*lf_graph_info, bound_values);
params.set_output("Function", std::move(closure));
params.set_default_remaining_outputs();

View File

@ -72,14 +72,14 @@ Closure Closure ::make_from_node_tree(const bNodeTree *node_tree)
}
BLI_assert(node_tree->runtime);
const std::unique_ptr<blender::nodes::GeometryNodesLazyFunctionGraphInfo> &lf_graph_info_ptr =
node_tree->runtime->geometry_nodes_lazy_function_graph_info;
BLI_assert(lf_graph_info_ptr);
const blender::nodes::GeometryNodesLazyFunctionGraphInfo *lf_graph_info =
ensure_geometry_nodes_lazy_function_graph(*node_tree);
BLI_assert(lf_graph_info);
Array<GMutablePointer> bound_values(node_tree->interface_inputs().size());
// TODO fill with default values of the tree
return Closure(*lf_graph_info_ptr.get(), bound_values);
return Closure(*lf_graph_info, bound_values);
}
} // namespace blender::nodes