[Bf-blender-cvs] [97e0cc41ca1] master: Nodes: Simplify view panning when selecting node

Hans Goudey noreply at git.blender.org
Sun Nov 20 21:49:10 CET 2022


Commit: 97e0cc41ca109177c3b2b76c3faf06c91e194664
Author: Hans Goudey
Date:   Sun Nov 20 14:07:04 2022 -0600
Branches: master
https://developer.blender.org/rB97e0cc41ca109177c3b2b76c3faf06c91e194664

Nodes: Simplify view panning when selecting node

The "Activate Same Type Next/Prev" and "Find Node" operators pan
the view to the newly selected node if it's outside of the view. This
simplifies that check and improves it in the case where the node
is only partially visible-- now it pans in while it didn't before.

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

M	source/blender/editors/space_node/node_select.cc

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

diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc
index 2604c6fa1dc..998d8b7d157 100644
--- a/source/blender/editors/space_node/node_select.cc
+++ b/source/blender/editors/space_node/node_select.cc
@@ -1274,11 +1274,7 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
 
   node_select_single(*C, *new_active_node);
 
-  /* is note outside view? */
-  if (new_active_node->runtime->totr.xmax < region->v2d.cur.xmin ||
-      new_active_node->runtime->totr.xmin > region->v2d.cur.xmax ||
-      new_active_node->runtime->totr.ymax < region->v2d.cur.ymin ||
-      new_active_node->runtime->totr.ymin > region->v2d.cur.ymax) {
+  if (!BLI_rctf_inside_rctf(&region->v2d.cur, &new_active_node->runtime->totr)) {
     const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
     space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx);
   }
@@ -1361,11 +1357,7 @@ static void node_find_exec_fn(bContext *C, void * /*arg1*/, void *arg2)
     ARegion *region = CTX_wm_region(C);
     node_select_single(*C, *active);
 
-    /* is note outside view? */
-    if (active->runtime->totr.xmax < region->v2d.cur.xmin ||
-        active->runtime->totr.xmin > region->v2d.cur.xmax ||
-        active->runtime->totr.ymax < region->v2d.cur.ymin ||
-        active->runtime->totr.ymin > region->v2d.cur.ymax) {
+    if (!BLI_rctf_inside_rctf(&region->v2d.cur, &active->runtime->totr)) {
       space_node_view_flag(*C, *snode, *region, NODE_SELECT, U.smooth_viewtx);
     }
   }



More information about the Bf-blender-cvs mailing list