Nodes: minor speedup for usage inferencing

This reduces some overhead for group input nodes where many sockets are not used.
This helps a bit with resolving the performance regression in #146949.

Pull Request: https://projects.blender.org/blender/blender/pulls/147610
This commit is contained in:
Jacques Lucke
2025-10-08 13:00:38 +02:00
parent 3e0df5d2d7
commit 8ef6127b70

View File

@@ -105,8 +105,12 @@ class SocketUsageInferencerImpl {
bool is_group_input_used(const int input_i)
{
for (const bNode *node : root_tree_.group_input_nodes()) {
const SocketInContext socket{nullptr, &node->output_socket(input_i)};
if (this->is_socket_used(socket)) {
const bNodeSocket &socket = node->output_socket(input_i);
if (!socket.is_directly_linked()) {
continue;
}
const SocketInContext socket_ctx{nullptr, &socket};
if (this->is_socket_used(socket_ctx)) {
return true;
}
}