Geometry Nodes: make evaluation and logging system aware of zones #109029

Closed
Jacques Lucke wants to merge 93 commits from JacquesLucke/blender:zone-evaluation into main

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

View File

@ -38,6 +38,8 @@ struct TreeZone {
class TreeZones {
public:
Vector<std::unique_ptr<TreeZone>> zones;
Vector<TreeZone *> root_zones;
Vector<const bNode *> nodes_outside_zones;
/**
* Zone index by node. Nodes that are in no zone, are not included. Nodes that are at the border
* of a zone (e.g. Simulation Input) are mapped to the zone they create.

View File

@ -111,7 +111,8 @@ static void update_zone_per_node(const Span<const bNode *> all_nodes,
const Span<std::unique_ptr<TreeZone>> all_zones,
const BitGroupVector<> &depend_on_input_flag_array,
const Map<const bNode *, TreeZone *> &zone_by_inout_node,
Map<int, int> &r_zone_by_node_id)
Map<int, int> &r_zone_by_node_id,
Vector<const bNode *> &r_node_outside_zones)
{
for (const int node_i : all_nodes.index_range()) {
const bNode &node = *all_nodes[node_i];
@ -126,7 +127,10 @@ static void update_zone_per_node(const Span<const bNode *> all_nodes,
parent_zone = zone;
}
});
if (parent_zone != nullptr) {
if (parent_zone == nullptr) {
r_node_outside_zones.append(&node);
}
else {
r_zone_by_node_id.add(node.identifier, parent_zone->index);
}
}
@ -216,11 +220,18 @@ static std::unique_ptr<TreeZones> discover_tree_zones(const bNodeTree &tree)
update_zone_depths(*zone);
}
for (std::unique_ptr<TreeZone> &zone : tree_zones->zones) {
if (zone->depth == 0) {
tree_zones->root_zones.append(zone.get());
}
}
update_zone_per_node(all_nodes,
tree_zones->zones,
depend_on_input_flag_array,
zone_by_inout_node,
tree_zones->zone_by_node_id);
tree_zones->zone_by_node_id,
tree_zones->nodes_outside_zones);
for (const int node_i : all_nodes.index_range()) {
const bNode *node = all_nodes[node_i];

View File

@ -1427,6 +1427,8 @@ struct GeometryNodesLazyFunctionGraphBuilder {
zone_build_infos_.reinitialize(tree_zones_->zones.size());
this->prepare_node_multi_functions();
for (const int zone_i : tree_zones_->zones.index_range()) {
ZoneBuildInfo &zone_info = zone_build_infos_[zone_i];
zone_info.lf_graph = &lf_graph_info_->scope.construct<lf::Graph>();
@ -1548,7 +1550,6 @@ struct GeometryNodesLazyFunctionGraphBuilder {
std::cout << "\n\n" << zone_info.lf_graph->to_dot() << "\n\n";
}
this->prepare_node_multi_functions();
this->build_group_input_node();
if (btree_.group_output_node() == nullptr) {
this->build_fallback_output_node();