[Bf-blender-cvs] [a43e4988788] master: Cleanup: Remove unnecessary node link flag

Hans Goudey noreply at git.blender.org
Fri Dec 16 21:47:27 CET 2022


Commit: a43e4988788a0dcea92da2367d6f8bc71ea8b2c6
Author: Hans Goudey
Date:   Fri Dec 16 12:00:30 2022 -0600
Branches: master
https://developer.blender.org/rBa43e4988788a0dcea92da2367d6f8bc71ea8b2c6

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.

===================================================================

M	source/blender/editors/space_node/drawnode.cc
M	source/blender/editors/space_node/node_relationships.cc
M	source/blender/makesdna/DNA_node_types.h

===================================================================

diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 708efc0c7a6..16771ef7347 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -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;
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index 450d3bff286..ea6502dbf00 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -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);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 6acb2208962..97505fdf5fe 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -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



More information about the Bf-blender-cvs mailing list