diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-03 03:06:12 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-03 03:06:12 +0300 |
commit | 0348bc88e4c1e26724d2469bab9f50c2ac5cf259 (patch) | |
tree | e92090425583ef38fb140bbde6eda4be3f666b6e | |
parent | 2d72fc058613aa2c3ecfa75871bd72e12835d2bf (diff) |
Cleanup: Return early
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 26e245c3cf5..d06864f4a8b 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -1435,48 +1435,48 @@ static int mute_links_exec(bContext *C, wmOperator *op) } RNA_END; - if (i > 1) { - ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); + if (i <= 1) { + return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; + } - /* Count intersected links and clear test flag. */ - int tot = 0; - LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { - if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { - continue; - } - link->flag &= ~NODE_LINK_TEST; - if (node_links_intersect(*link, mcoords, i)) { - tot++; - } + ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); + + /* Count intersected links and clear test flag. */ + int tot = 0; + LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { + if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { + continue; } - if (tot == 0) { - return OPERATOR_CANCELLED; + link->flag &= ~NODE_LINK_TEST; + if (node_links_intersect(*link, mcoords, i)) { + tot++; } + } + if (tot == 0) { + return OPERATOR_CANCELLED; + } - /* Mute links. */ - LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { - if (node_link_is_hidden_or_dimmed(region.v2d, *link) || (link->flag & NODE_LINK_TEST)) { - continue; - } - - if (node_links_intersect(*link, mcoords, i)) { - nodeMuteLinkToggle(snode.edittree, link); - } + /* Mute links. */ + LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { + if (node_link_is_hidden_or_dimmed(region.v2d, *link) || (link->flag & NODE_LINK_TEST)) { + continue; } - /* Clear remaining test flags. */ - LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { - if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { - continue; - } - link->flag &= ~NODE_LINK_TEST; + if (node_links_intersect(*link, mcoords, i)) { + nodeMuteLinkToggle(snode.edittree, link); } + } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); - return OPERATOR_FINISHED; + /* Clear remaining test flags. */ + LISTBASE_FOREACH (bNodeLink *, link, &snode.edittree->links) { + if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { + continue; + } + link->flag &= ~NODE_LINK_TEST; } - return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; + ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); + return OPERATOR_FINISHED; } void NODE_OT_links_mute(wmOperatorType *ot) |