diff options
author | Ton Roosendaal <ton@blender.org> | 2013-09-05 17:03:03 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-09-05 17:03:03 +0400 |
commit | dc8832ac92b3640f7dcb784086417da925c9e721 (patch) | |
tree | 439fc0393e8b2bbfefdb840e64264739df653297 /source/blender/editors/space_node/node_select.c | |
parent | 69b68ed867407538a9b231cabf3481cb1404b37f (diff) |
Bugfix #35920
Adding a new node in Node Editor failed for "High DPI" (Only Mac retina now).
- Py script for adding nodes was doing dpi magic, which it shouldn't. It has
been replaced with a (temporary) API call to set the correct cursor location.
(Thanks to Lukas T for helping here)
- The SpaceNode->cursor[2] property now is *only* storing the coordinate
in "adding new node space". Use of this has been removed from the code where
possible, with as only exception the code to draw noodles while adding them.
Special coder note: Nodes should respect the DPI value, and draw larger with
larger buttons if you increase this size. The hack here is that this can only
work nice if also the node positions are scaled accordingly.
A better fix could be to check on scaling the node view itself for it. That
then would also remove this Python API call that was added in this commit.
However, that again might fight with how buttons layout code works now...
needs some careful checking.
Diffstat (limited to 'source/blender/editors/space_node/node_select.c')
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index e17699309ef..6ce31783bff 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -306,24 +306,21 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i { bNode *node, *tnode; bNodeSocket *sock, *tsock; - float mx, my; + float cursor[2]; int selected = 0; /* get mouse coordinates in view2d space */ - UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my); - /* node_find_indicated_socket uses snode->mx/my */ - snode->cursor[0] = mx; - snode->cursor[1] = my; + UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &cursor[0], &cursor[1]); if (extend) { /* first do socket selection, these generally overlap with nodes. * socket selection only in extend mode. */ - if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN)) { + if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) { node_socket_toggle(node, sock, 1); selected = 1; } - else if (node_find_indicated_socket(snode, &node, &sock, SOCK_OUT)) { + else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_OUT)) { if (sock->flag & SELECT) { node_socket_deselect(node, sock, 1); } @@ -341,7 +338,7 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i } else { /* find the closest visible node */ - node = node_under_mouse_select(snode->edittree, mx, my); + node = node_under_mouse_select(snode->edittree, cursor[0], cursor[1]); if (node) { if ((node->flag & SELECT) && (node->flag & NODE_ACTIVE) == 0) { @@ -362,7 +359,7 @@ static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const i else { /* extend == 0 */ /* find the closest visible node */ - node = node_under_mouse_select(snode->edittree, mx, my); + node = node_under_mouse_select(snode->edittree, cursor[0], cursor[1]); if (node) { for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) { |