Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-02 23:48:41 +0300
committerHans Goudey <h.goudey@me.com>2022-09-02 23:48:41 +0300
commit831ed297d0a02c34664d2a5d8367fbacb899a4a2 (patch)
tree60522cb2a53c6ddaa6b8022d87236bd2133bd432
parent28d8076a2e4e98002a3d455930b13366947e71ee (diff)
Fix T100767: Geometry nodes viewer node placed incorrectly
See explanation in comment. Differential Revision: https://developer.blender.org/D15864
-rw-r--r--source/blender/editors/space_node/node_relationships.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index e10bedb18f4..ce4ae421498 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -639,8 +639,13 @@ static int link_socket_to_viewer(const bContext &C,
if (viewer_bnode == nullptr) {
/* Create a new viewer node if none exists. */
const int viewer_type = get_default_viewer_type(&C);
- viewer_bnode = node_add_node(
- C, nullptr, viewer_type, bsocket_to_view.locx + 100, bsocket_to_view.locy);
+ /* The socket location is in view space, so dividing by #UI_DPI_FAC
+ * brings it into the coordinate space of the node editor. */
+ viewer_bnode = node_add_node(C,
+ nullptr,
+ viewer_type,
+ bsocket_to_view.locx / UI_DPI_FAC + 100,
+ bsocket_to_view.locy / UI_DPI_FAC);
if (viewer_bnode == nullptr) {
return OPERATOR_CANCELLED;
}