[Bf-blender-cvs] [998ffcbf096] master: Fix: Make node position consistent when added through link drag search

Leon Schittek noreply at git.blender.org
Sun Sep 18 20:30:01 CEST 2022


Commit: 998ffcbf096eb1f2dd04ac8c762db1f6074a1c8a
Author: Leon Schittek
Date:   Sun Sep 18 20:18:50 2022 +0200
Branches: master
https://developer.blender.org/rB998ffcbf096eb1f2dd04ac8c762db1f6074a1c8a

Fix: Make node position consistent when added through link drag search

The node position is specified in the coordinate space of the node
editor. The cursor position has to be divided by `UI_DPI_FAC` since it's
in view space but the offset is independent of any ui scaling.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16006

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

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

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

diff --git a/source/blender/editors/space_node/link_drag_search.cc b/source/blender/editors/space_node/link_drag_search.cc
index f1387da97b5..03bd0b5b36a 100644
--- a/source/blender/editors/space_node/link_drag_search.cc
+++ b/source/blender/editors/space_node/link_drag_search.cc
@@ -214,7 +214,7 @@ static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2)
   bNode *new_node = new_nodes.first();
 
   new_node->locx = storage.cursor.x / UI_DPI_FAC;
-  new_node->locy = storage.cursor.y / UI_DPI_FAC + 20 * UI_DPI_FAC;
+  new_node->locy = storage.cursor.y / UI_DPI_FAC + 20;
   if (storage.in_out() == SOCK_IN) {
     new_node->locx -= new_node->width;
   }



More information about the Bf-blender-cvs mailing list