[Bf-blender-cvs] [331e8007ed4] blender-v3.4-release: Fix T102520: Positioning of nodes added via search
Leon Schittek
noreply at git.blender.org
Sat Nov 19 19:08:41 CET 2022
Commit: 331e8007ed403ea30bc74f2eeaa40399212a5a18
Author: Leon Schittek
Date: Sat Nov 19 19:03:38 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB331e8007ed403ea30bc74f2eeaa40399212a5a18
Fix T102520: Positioning of nodes added via search
Always position the nodes added with the node search at the point where
the search operator was invoked by ensuring the operator context is the
main node editor region.
This was an unintended change of rBbdb57541475f, caused by the operator
now getting the cursor position in region space. So when the operator
was called from the menu, it would get the cursor position in the
region space of the menu, which lead to an offset when adding the node
since it expected the coordinates to be in the space of the node editor.
Setting the correct operator context also fixes inconsistent transform
sensitivity depending on zoom when adding nodes via the search in the
menu which has been an issue since as far back as Blender 2.79.
Also includes a small fix for the vertical offset of nodes added by the
search which varied depending on the UI scale. Same fix as in
rB998ffcbf096e.
Reviewed By: Hans Goudey
Differential Revision: http://developer.blender.org/D16555
===================================================================
M release/scripts/startup/bl_ui/space_node.py
M source/blender/editors/space_node/add_node_search.cc
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 593c6400529..90744d9f359 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -219,7 +219,7 @@ class NODE_MT_add(bpy.types.Menu):
import nodeitems_utils
layout = self.layout
- layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator_context = 'INVOKE_REGION_WIN'
snode = context.space_data
if snode.tree_type == 'GeometryNodeTree':
diff --git a/source/blender/editors/space_node/add_node_search.cc b/source/blender/editors/space_node/add_node_search.cc
index 28e18c20f46..eccc6848b8e 100644
--- a/source/blender/editors/space_node/add_node_search.cc
+++ b/source/blender/editors/space_node/add_node_search.cc
@@ -256,7 +256,7 @@ static void add_node_search_exec_fn(bContext *C, void *arg1, void *arg2)
}
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;
nodeSetSelected(new_node, true);
nodeSetActive(&node_tree, new_node);
More information about the Bf-blender-cvs
mailing list