Maniphest T76481

GPencil: Fast clicks over Dopesheet left icons active layer renaming
Closed, ResolvedKNOWN ISSUE

Assigned To
Julian Eisel (Severin)
Authored By
Lukas Sabaliauskas (Trukas)
May 6 2020, 6:49 PM
Tags
  • BF Blender
Subscribers
Antonio Vazquez (antoniov)
Campbell Barton (campbellbarton)
Hans Goudey (HooglyBoogly)
Julian Eisel (Severin)
Lukas Sabaliauskas (Trukas)

Description

System Information
Operating system: Windows 10 Famille 64-bit (10.0, Build 18363) (18362.19h1_release.190318-1202)
Graphics card: NVIDIA GeForce GTX 1050

Blender Version
Broken: 2.82

Short description of error
Double clicking on a grease pencil layer's options icons twice triggers the renaming of that layer.

Exact steps for others to reproduce the error
Based on the default startup, with any grease pencil object with a layer. The problem occurs in the Dope Sheet editor panel, under the grease pencil drop down menu, in the left pannel where the layers are at. Double clicking on any of a layer's options icons (Mask, Onion Skin, Eye, Lock) twice triggers the renaming of that layer as if I was clicking on the name of the layer. This window resembles a lot the Object Data Properties, under the Layer dropout, but here I can quickly switch on and off any of the icons.

Thanks !

Revisions and Commits

rB Blender

Event Timeline

Lukas Sabaliauskas (Trukas) created this task.May 6 2020, 6:49 PM
Antonio Vazquez (antoniov) changed the task status from Needs Triage to Confirmed.May 6 2020, 7:38 PM
Antonio Vazquez (antoniov) changed the subtype of this task from "Report" to "Known Issue".
Antonio Vazquez (antoniov) added subscribers: Julian Eisel (Severin), Antonio Vazquez (antoniov).

@Julian Eisel (Severin) do you think is possible to reduce the sensitivity here to fast clicks?

Antonio Vazquez (antoniov) renamed this task from Grease Pencil layer renaming to GPencil: Fast clicks over Dopesheet left icons active layer renaming.May 6 2020, 7:39 PM
Hans Goudey (HooglyBoogly) added a subscriber: Hans Goudey (HooglyBoogly).EditedMay 6 2020, 8:42 PM

IMO the proper solution is for clicks on buttons to swallow the first click of a double-click event. The double click timer shouldn't need to be adjusted per region.

Another solution would be to change NLACHANNEL_NAMEWIDTH in animchannels_channel_get to subtract the width of the buttons on the right from the size of the channel list region. That way the double-click event would only find a channel and execute if wasn't on a button.
That second solution is pretty simple, it just loses some generality because the number of buttons changes in different contexts.

Antonio Vazquez (antoniov) added a comment.May 6 2020, 9:46 PM

@Hans Goudey (HooglyBoogly) Can you manage it? I don't know the UI code too much.

Hans Goudey (HooglyBoogly) added a subscriber: Campbell Barton (campbellbarton).May 12 2020, 8:48 PM

I looked into this issue for a while. I was trying to change is the fact that the first click event which toggles the button is also the first click of a double-click event.

P1387 My idea here was to mark "handled" events so they don't act as the first event of a double event. This works, but the problem is that handlers that aren't from buttons can return "handled == true," meaning that double-click doesn't work at all in the dope-sheet list.

Building the interface to get rid of the overlapping buttons is probably the right approach.

@Campbell Barton (campbellbarton) Disregarding the implementation in the paste, do you agree that trying to not use handled events as the first of a double event is not the right approach?

Julian Eisel (Severin) added a comment.EditedMay 13 2020, 2:29 AM

The issues you're facing with that approach are just what I'd have expected, although I think it was worth playing with. The way this is done is pretty old, and I'd expect quite some cases to depend on the exact event system behavior. That's why changes in the event system are always tricky...

I'd propose fixing this by letting the toggle icons respect double-click events, so letting them swallow the double click before it get a chance to be passed to the renaming operator. This works well for me:

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ead36fdbd19..ebef83ab688 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4443,7 +4443,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons
         do_activate = (event->val == KM_RELEASE);
       }
       else {
-        do_activate = (event->val == KM_PRESS);
+        do_activate = ELEM(event->val, KM_PRESS, KM_DBL_CLICK);
       }
     }
 
@@ -8871,7 +8871,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
        * This is needed to make sure if a button was active,
        * it stays active while the mouse is over it.
        * This avoids adding mousemoves, see: [#33466] */
-      if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT)) {
+      if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT, BUTTON_STATE_WAIT_DRAG)) {
         if (ui_but_find_mouse_over(region, event) == but) {
           button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
         }

(The second change is needed to detect the hovered button correctly. Without it appeared to randomly work or not with a touchpad.)

Hans Goudey (HooglyBoogly) added a comment.May 13 2020, 3:10 AM
In T76481#930350, @Julian Eisel (Severin) wrote:

The issues you're facing with that approach are just what I'd have expected, although I think it was worth playing with. The way this is done is pretty old, and I'd expect quite some cases to depend on the exact event system behavior. That's why changes in the event system are always tricky...

Yeah, it would have been nice if it worked out. I learned a fair bit anyway. Although the two variables "evt" and "event" are a bit cruel :P

I'd propose fixing this by letting the toggle icons respect double-click events, so letting them swallow the double click before it get a chance to be passed to the renaming operator.

Oh, clever, I didn't think of that. I guess it's not the "right" way but I don't see anything wrong with it!

Julian Eisel (Severin) closed this task as Resolved by committing rB099dd0690ced: Fix T76481: Fast clicks over Dopesheet toggles trigger renaming.May 13 2020, 11:52 AM
Julian Eisel (Severin) claimed this task.
Julian Eisel (Severin) added a commit: rB099dd0690ced: Fix T76481: Fast clicks over Dopesheet toggles trigger renaming.