Fix: Missing update when toggling node mute

Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).

Differential Revision: https://developer.blender.org/D13653
This commit is contained in:
Hans Goudey 2021-12-22 14:00:17 -06:00
parent 586e2face6
commit b4f978e901
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #94332, Muting or Unmuting a node doesn't update the state correctly
3 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,7 @@ void BKE_ntree_update_tag_all(struct bNodeTree *ntree);
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_new(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_removed(struct bNodeTree *ntree);
void BKE_ntree_update_tag_node_mute(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_internal_link(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_socket_property(struct bNodeTree *ntree, struct bNodeSocket *socket);

View File

@ -1571,6 +1571,11 @@ void BKE_ntree_update_tag_node_removed(bNodeTree *ntree)
add_tree_tag(ntree, NTREE_CHANGED_REMOVED_NODE);
}
void BKE_ntree_update_tag_node_mute(bNodeTree *ntree, bNode *node)
{
add_node_tag(ntree, node, NTREE_CHANGED_NODE_PROPERTY);
}
void BKE_ntree_update_tag_node_internal_link(bNodeTree *ntree, bNode *node)
{
add_node_tag(ntree, node, NTREE_CHANGED_INTERNAL_LINK);

View File

@ -1734,6 +1734,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) {
if ((node->flag & SELECT) && !node->typeinfo->no_muting) {
node->flag ^= NODE_MUTED;
BKE_ntree_update_tag_node_mute(snode->edittree, node);
}
}