Geometry Nodes: add panel for generated geometry on foreach zone

The panel makes the separation of the main geometry and generated geometry
outputs more obvious.

Pull Request: https://projects.blender.org/blender/blender/pulls/128382
This commit is contained in:
Jacques Lucke
2024-09-30 21:28:20 +02:00
parent 71033685f6
commit 8f30c25207

View File

@@ -442,24 +442,26 @@ static void node_declare(NodeDeclarationBuilder &b)
}
b.add_input<decl::Extend>("", "__extend__main");
b.add_output<decl::Extend>("", "__extend__main").align_with_previous();
b.add_separator();
auto &panel = b.add_panel("Generated");
int previous_geometry_index = -1;
for (const int i : IndexRange(storage.generation_items.items_num)) {
const NodeForeachGeometryElementGenerationItem &item = storage.generation_items.items[i];
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(item.socket_type);
if (socket_type == SOCK_GEOMETRY && i > 0) {
b.add_separator();
panel.add_separator();
}
const StringRef name = item.name ? item.name : "";
std::string identifier =
ForeachGeometryElementGenerationItemsAccessor::socket_identifier_for_item(item);
auto &input_decl = b.add_input(socket_type, name, identifier)
auto &input_decl = panel.add_input(socket_type, name, identifier)
.socket_name_ptr(
&tree->id,
ForeachGeometryElementGenerationItemsAccessor::item_srna,
&item,
"name");
auto &output_decl = b.add_output(socket_type, name, identifier).align_with_previous();
auto &output_decl = panel.add_output(socket_type, name, identifier).align_with_previous();
if (socket_type == SOCK_GEOMETRY) {
previous_geometry_index = output_decl.index();
aal::PropagateRelation relation;
@@ -481,10 +483,9 @@ static void node_declare(NodeDeclarationBuilder &b)
output_decl.description("Attribute on the geometry above");
}
}
panel.add_input<decl::Extend>("", "__extend__generation");
panel.add_output<decl::Extend>("", "__extend__generation").align_with_previous();
}
b.add_input<decl::Extend>("", "__extend__generation");
b.add_output<decl::Extend>("", "__extend__generation").align_with_previous();
}
static void node_init(bNodeTree * /*tree*/, bNode *node)