diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-08 18:52:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-08 18:52:30 +0300 |
commit | 33729eaf69c3220ebf791b9260bfca1bb3c5048a (patch) | |
tree | e52c78e56875f8e4f186ac73bc9fdfeb97a68e04 | |
parent | 2e9854536f1c64079e8cd8a1cb617b0f5473a7e2 (diff) |
improve behavior
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 14a0941bd2e..620821c708f 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -1709,25 +1709,39 @@ static int make_link_portals_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), bmain); - bool changed_link = false; + blender::Vector<bNodeLink *> intersecting_links; LISTBASE_FOREACH (bNodeLink *, link, &snode->edittree->links) { if (node_link_is_hidden_or_dimmed(®ion->v2d, link)) { continue; } if (node_links_intersect(link, coords, tot_coords)) { - if (link->flag & NODE_LINK_PORTAL) { - link->flag &= ~NODE_LINK_PORTAL; - } - else { - link->flag |= NODE_LINK_PORTAL; - } - changed_link = true; + intersecting_links.append(link); } } - if (!changed_link) { + if (intersecting_links.is_empty()) { return OPERATOR_CANCELLED; } + + bool any_link_is_portal = false; + for (bNodeLink *link : intersecting_links) { + if (nodeLinkIsPortal(link)) { + any_link_is_portal = true; + break; + } + } + + if (any_link_is_portal) { + for (bNodeLink *link : intersecting_links) { + link->flag &= ~NODE_LINK_PORTAL; + } + } + else { + for (bNodeLink *link : intersecting_links) { + link->flag |= NODE_LINK_PORTAL; + } + } + snode_notify(C, snode); return OPERATOR_FINISHED; } |