Nodes: Skip node tree update for unused sockets of muted node #109088
|
@ -2912,7 +2912,25 @@ static void rna_NodeSocket_update(Main *bmain, Scene * /*scene*/, PointerRNA *pt
|
|||
{
|
||||
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
|
||||
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
||||
|
||||
const bool skip_tree_update = [&]() -> bool {
|
||||
mod_moder marked this conversation as resolved
Outdated
|
||||
if (!sock->is_input()) {
|
||||
return false;
|
||||
}
|
||||
ntree->ensure_topology_cache();
|
||||
const bNode &node = sock->owner_node();
|
||||
if (!node.is_muted()) {
|
||||
return false;
|
||||
}
|
||||
for (const bNodeLink &link : node.internal_links()) {
|
||||
if (link.fromsock == sock) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
if (skip_tree_update) {
|
||||
return;
|
||||
}
|
||||
BKE_ntree_update_tag_socket_property(ntree, sock);
|
||||
ED_node_tree_propagate_change(nullptr, bmain, ntree);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Why use
[=]
instead of[&]
?Just socket/tree pointers, can be captured by value
Yeah, generally prefer
[&]
if the lambda does not leave the current scope, unless there is a good reason for doing something else.