Cleanup: Remove unnecessary node link flag

Links that are currently being dragged are now stored outside
of the node tree, so we don't need a flag to distinguish them
from "proper" links.
This commit is contained in:
Hans Goudey 2022-12-16 12:00:30 -06:00
parent 5ffcd8779e
commit a43e498878
3 changed files with 1 additions and 7 deletions

View File

@ -2199,7 +2199,7 @@ void node_draw_link(const bContext &C,
}
/* Links from field to non-field sockets are not allowed. */
if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & NODE_LINK_DRAGGED)) {
if (snode.edittree->type == NTREE_GEOMETRY) {
if ((link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) &&
(link.tosock && link.tosock->display_shape == SOCK_DISPLAY_SHAPE_CIRCLE)) {
th_col1 = th_col2 = th_col3 = TH_REDALERT;

View File

@ -91,7 +91,6 @@ static bNodeLink *create_drag_link(bNode &node, bNodeSocket &sock)
oplink->tosock = &sock;
}
oplink->flag |= NODE_LINK_VALID;
oplink->flag |= NODE_LINK_DRAGGED;
return oplink;
}
@ -903,8 +902,6 @@ static void node_link_exit(bContext &C, wmOperator &op, const bool apply_links)
bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op.customdata;
for (bNodeLink *link : nldrag->links) {
link->flag &= ~NODE_LINK_DRAGGED;
if (apply_links && link->tosock && link->fromsock) {
/* before actually adding the link,
* let nodes perform special link insertion handling
@ -1110,7 +1107,6 @@ static std::unique_ptr<bNodeLinkDrag> node_link_init(SpaceNode &snode,
*oplink = *link;
oplink->next = oplink->prev = nullptr;
oplink->flag |= NODE_LINK_VALID;
oplink->flag |= NODE_LINK_DRAGGED;
nldrag->links.append(oplink);
nodeRemLink(snode.edittree, link);
@ -1153,7 +1149,6 @@ static std::unique_ptr<bNodeLinkDrag> node_link_init(SpaceNode &snode,
*oplink = *link_to_pick;
oplink->next = oplink->prev = nullptr;
oplink->flag |= NODE_LINK_VALID;
oplink->flag |= NODE_LINK_DRAGGED;
nldrag->links.append(oplink);
nodeRemLink(snode.edittree, link_to_pick);

View File

@ -499,7 +499,6 @@ typedef struct bNodeLink {
#define NODE_LINK_TEST (1 << 2) /* free test flag, undefined */
#define NODE_LINK_TEMP_HIGHLIGHT (1 << 3) /* Link is highlighted for picking. */
#define NODE_LINK_MUTED (1 << 4) /* Link is muted. */
#define NODE_LINK_DRAGGED (1 << 5) /* Node link is being dragged by the user. */
/* tree->edit_quality/tree->render_quality */
#define NTREE_QUALITY_HIGH 0