diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-03 00:20:01 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-03 00:20:01 +0300 |
commit | a736ca33ab08bc72d17418d0e55c164aa8e306d8 (patch) | |
tree | 2ef1db0e86c778a45c59a030936525c2732542e3 /source/blender | |
parent | 0b4b3abc0bedf83a0c03732f5de8088ca9627b3a (diff) |
Cleanup: Return early
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 05d0a546b08..cf6e83c9450 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -1347,39 +1347,39 @@ static int cut_links_exec(bContext *C, wmOperator *op) } RNA_END; - if (i > 1) { - bool found = false; + if (i == 0) { + return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; + } - ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); + bool found = false; - LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode.edittree->links) { - if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { - continue; - } + ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); - if (node_links_intersect(*link, mcoords, i)) { + LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode.edittree->links) { + if (node_link_is_hidden_or_dimmed(region.v2d, *link)) { + continue; + } - if (found == false) { - /* TODO(sergey): Why did we kill jobs twice? */ - ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); - found = true; - } + if (node_links_intersect(*link, mcoords, i)) { - bNode *to_node = link->tonode; - nodeRemLink(snode.edittree, link); - sort_multi_input_socket_links(snode, *to_node, nullptr, nullptr); + if (!found) { + /* TODO(sergey): Why did we kill jobs twice? */ + ED_preview_kill_jobs(CTX_wm_manager(C), &bmain); + found = true; } - } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); - if (found) { - return OPERATOR_FINISHED; + bNode *to_node = link->tonode; + nodeRemLink(snode.edittree, link); + sort_multi_input_socket_links(snode, *to_node, nullptr, nullptr); } + } - return OPERATOR_CANCELLED; + ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); + if (found) { + return OPERATOR_FINISHED; } - return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; + return OPERATOR_CANCELLED; } void NODE_OT_links_cut(wmOperatorType *ot) |