Maniphest T81824

Issue with moving nodes when the tweak tool is active and the node item properties panel is expanded
Closed, ResolvedBUG

Assigned To
Pi Lanningham (Quantumplation)
Authored By
Vyacheslav (hitrpr)
Oct 19 2020, 3:59 AM
Tags
  • BF Blender
  • User Interface
Subscribers
Campbell Barton (campbellbarton)
Hans Goudey (HooglyBoogly)
Philipp Oeser (lichtwerk)
Pi Lanningham (Quantumplation)
Vyacheslav (hitrpr)
Tokens
"Love" token, awarded by hitrpr.

Description

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.87

Blender Version
Broken: version: 2.83.7, branch: master, commit date: 2020-09-30 06:12, hash: rB192e591af9fb
Broken 2.91.0
Tested with factory settings too.

Short description of error
Sometimes I can`t press and drag nodes in this file. There is no issue with new file (i think).
This file was saved with different versions of blender, so this may be a reason. But bug appears randomly. mostly after selecting parent frame.
Nodes was a part of big tree.

Seems to only be the case with:

  • [1] The Tweak tool active and
  • [2] in the sidebar, have the Item tab active and
  • [3] have the Properties panel expanded

Here the demonstration:

File:

Revisions and Commits

rB Blender
Closed

Event Timeline

Vyacheslav (hitrpr) created this task.Oct 19 2020, 3:59 AM
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Oct 19 2020, 10:05 AM
Philipp Oeser (lichtwerk) added projects: User Interface, Nodes.
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).

Hm interesting.

Can confirm, seems to only be the case with:

  • [1] The Tweak tool active and
  • [2] in the sidebar, have the Item tab active and
  • [3] have the Properties panel expanded
Philipp Oeser (lichtwerk) renamed this task from Issue with moving nodes in particular file to Issue with moving nodes when the tweak tool is active and the node item properties panel is expanded.Oct 19 2020, 10:06 AM
Philipp Oeser (lichtwerk) updated the task description.
Vyacheslav (hitrpr) added a comment.Oct 19 2020, 6:11 PM

@Philipp Oeser (lichtwerk) weird, but I am glad, you reproduced it.
Thanks for details. At least I can hide N-panel to avoid it.

Hans Goudey (HooglyBoogly) added a subscriber: Hans Goudey (HooglyBoogly).Oct 19 2020, 11:47 PM

Okay, I've played around with this for a while, and can say that it's easily the weirdest bug I've seen in Blender to date.

  • Yes, the tweak tool needs to be active.
  • The properties panel needs to be open, but it works with the code in it commented out.

Basically I think the correct operator isn't being called. I have no idea how the properties panel could relate to that, but it does somehow...
With some handy printf debugging:

Working Tweak

node_select_exec
node_select_exec
node_select_box_poll: true # Note: this is the operator for the Tweak tool
node_box_select_invoke

Broken Tweak

node_select_exec
node_select_exec

I don't have much more time to look at this now, but I would check the event system next to figure out if "Tweak" events aren't being properly passed to the operators.
On the other hand, it could be related to the more recently added "Wait to deselect others" code.

Hans Goudey (HooglyBoogly) moved this task from Backlog to Bugs on the User Interface board.Jan 7 2021, 7:15 AM
Pi Lanningham (Quantumplation) claimed this task.Jan 13 2021, 9:12 AM
Pi Lanningham (Quantumplation) added a subscriber: Pi Lanningham (Quantumplation).

I've started looking into this.

One thing I noticed is that this only happens when switching from one node type to another; i.e. if you duplicate one of the nodes, and are switching back and forth between those, it works fine. But when you switch from the Separate XYZ node to the Map Range node, it doesn't let you drag to position the node.

I'm slowly working up the stack of the WM event stuff to figure out why this doesn't get called when switching nodes, but it's pretty slow going, so I'm putting it down for today. I hope to get back to it some time later this week.

Specifically (mostly notes for me when I pick it back up, or someone else if I get pulled away from this for too long):

Normally after the new node of the same type is selected, the WM loop runs invoke/macro calls for the NODE_OT_translate_attach command as the mouse moves ("Move and Attach").

But when switching node types it doesn't invoke this at all.

NODE_OT_translate_attach is created as a global op with WM_operatortype_append_macro, which always uses wm_macro_invoke / wm_macro_modal / etc. That's as far as I've traced it, the next step is to figure out why wm_macro_invoke doesn't get invoked when switching node types (and, strangely, only when the properties tab is expanded?)

Pi Lanningham (Quantumplation) added a comment.Jan 14 2021, 6:21 AM

I have some more triage info after another day of looking into this. I'm writing this down mostly so that I can refresh myself tomorrow, but also so that if I get pulled away from triaging this someone else can retrace my steps.

I figured out how to turn on debugging on the command line in blender, which helped a lot. I'm attaching relevant sections of logs from an instance where click->drag is successful (i.e. you're clicking on another node of the same type), and one where it's a failure (switching type).


In the failure case, we never emit the EVT_TWEAK_L event; there are a few places this is constructed and emitted, and with some printf debugging, the one that gets called in the successful case is in wm_gesture_ops.c:528:

if (val != 0) {
  wmEvent tevent;

  wm_event_init_from_window(window, &tevent);
  /* We want to get coord from start of drag,
   * not from point where it becomes a tweak event, see T40549. */
  tevent.x = rect->xmin + gesture->winrct.xmin;
  tevent.y = rect->ymin + gesture->winrct.ymin;
  if (gesture->event_type == LEFTMOUSE) {
    tevent.type = EVT_TWEAK_L;
  }
  else if (gesture->event_type == RIGHTMOUSE) {
    tevent.type = EVT_TWEAK_R;
  }
  else {
    tevent.type = EVT_TWEAK_M;
  }
  tevent.val = val;
  tevent.is_repeat = false;
  /* mouse coords! */

  /* important we add immediately after this event, so future mouse releases
   * (which may be in the queue already), are handled in order, see T44740 */
  wm_event_add_ex(window, &tevent, event);

  gesture_end = true;
}

In the successful case, wm_tweak_modal is called 5 times: in the first 4, wm_gesture_evaluate returns 0, and in the 5th one it returns 3.

In the failure case, wm_tweak_modal is never called, and so the EVT_TWEAK_L event is never emitted.

Tomorrow's work will involve tracking down the places that gesture_tweak_modal is called, and figuring out why it's not being called in the failure case.

Pi Lanningham (Quantumplation) added a comment.Jan 15 2021, 2:12 AM

Todays debugging was somewhat of a wash. I've managed to confuse myself thoroughly on which methods are which and how the event handling code is glued together... lol. Though I did discover that it seems to be timing related; Often, if I'm stepping through in the debugger, the node translates fine. Similarly, when running blender with purely a software debugger (which slows things down considerably), it is very difficult to reproduce the issue. Maybe that provides some hints to someone who can chime in.

Campbell Barton (campbellbarton) added a revision: D14499: Fix T96520 Node editor: Tweak fails with unselected nodes.EditedMar 31 2022, 8:31 AM
Campbell Barton (campbellbarton) added a subscriber: Campbell Barton (campbellbarton).

Recently I looked into T96520 which is practically the same bug - it just happens more often after recent changes to the event system, D14499 also fixes this bug.

Campbell Barton (campbellbarton) closed this task as Resolved by committing rB4c3e91e5f565: Fix T96520 Node editor: Tweak fails with unselected nodes.May 10 2022, 3:02 PM
Campbell Barton (campbellbarton) added a commit: rB4c3e91e5f565: Fix T96520 Node editor: Tweak fails with unselected nodes.
Vyacheslav (hitrpr) awarded a token.May 11 2022, 12:01 AM
This comment was removed by Vyacheslav (hitrpr).
Hans Goudey (HooglyBoogly) removed a project: Nodes.May 16 2022, 11:08 AM