Fix T98191: Alt-LMB for node detach fails with RMB select

Regression caused by [0] which changed node selection to use
PRESS for selection and CLICK_DRAG to transform the selection.

This conflicted with Alt-LMB which would select the node then
pass-though to node.background_sample, preventing the drag event
from being activated.

Resolve by only activating background-sample when the cursor
isn't over a node or socket.

[0]: 4c3e91e5f5
This commit is contained in:
Campbell Barton 2022-05-18 14:25:05 +10:00
parent ffbeb34f5f
commit d7053ba030
Notes: blender-bot 2023-02-14 11:28:39 +01:00
Referenced by issue #98191, Regression: Node detach with alt + left mouse not working if right click selection active
3 changed files with 16 additions and 2 deletions

View File

@ -123,8 +123,6 @@ ENUM_OPERATORS(NodeResizeDirection, NODE_RESIZE_LEFT);
*/
float2 space_node_group_offset(const SpaceNode &snode);
rctf node_frame_rect_inside(const bNode &node);
int node_get_resize_cursor(NodeResizeDirection directions);
/**
* Usual convention here would be #node_socket_get_color(),
@ -161,6 +159,9 @@ void node_keymap(wmKeyConfig *keyconf);
/* node_select.cc */
rctf node_frame_rect_inside(const bNode &node);
bool node_or_socket_isect_event(bContext *C, const wmEvent *event);
void node_deselect_all(SpaceNode &snode);
void node_socket_select(bNode *node, bNodeSocket &sock);
void node_socket_deselect(bNode *node, bNodeSocket &sock, bool deselect_node);

View File

@ -48,6 +48,8 @@
namespace blender::ed::space_node {
static bool is_event_over_node_or_socket(bContext *C, const wmEvent *event);
/**
* Function to detect if there is a visible view3d that uses workbench in texture mode.
* This function is for fixing T76970 for Blender 2.83. The actual fix should add a mechanism in
@ -98,6 +100,11 @@ rctf node_frame_rect_inside(const bNode &node)
return frame_inside;
}
bool node_or_socket_isect_event(bContext *C, const wmEvent *event)
{
return is_event_over_node_or_socket(C, event);
}
static bool node_frame_select_isect_mouse(bNode *node, const float2 &mouse)
{
/* Frame nodes are selectable by their borders (including their whole rect - as for other nodes -

View File

@ -643,6 +643,12 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info;
/* Don't handle events intended for nodes (which rely on click/drag distinction).
* which this operator would use since sampling is normally activated on press, see: T98191. */
if (node_or_socket_isect_event(C, event)) {
return OPERATOR_PASS_THROUGH;
}
if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
return OPERATOR_CANCELLED;
}