Ctrl R in armature edit mode leaves snapping on
Closed, ResolvedPublic

Description

on default scene add an armature object
enter edit mode
with the bone selected *quickly* press Ctrl R (bone roll)
Grid snapping will remain active even if you aren't holding Ctrl anymore

note: if its done slowly it will work correctly

Daniel Salazar (zanqdo) set Type to Bug.Via Old WorldMay 9 2011, 7:46 AM
Ton Roosendaal (ton) added a comment.Via Old WorldMay 10 2011, 4:31 PM

Whatever I try here (OSX) ctrl+r never gives me a hanging snap on rotations.
Let's try to find someone else who can redo :)

Miika Hamalainen (miikah) added a comment.Via Old WorldMay 10 2011, 4:42 PM

Happens to me on Windows.

First I couldn't redo, but then I noticed I had to press both keys quickly, but release ctrl instantly but _before_ releasing r. ;)

Ton Roosendaal (ton) added a comment.Via Old WorldMay 10 2011, 4:44 PM

wait, got it!

pressing ctrl+r at *nearly* the same time, and release immediate, ctrl hangs

Ton Roosendaal (ton) added a comment.Via Old WorldMay 11 2011, 3:39 PM

Martin:

I've tracked it down to this commit:
http://projects.blender.org/scm/viewvc.php/trunk/blender/source/blender/editors/transform/transform.c?root=bf-blender&view=log#rev27495

/* Stupid code to have Ctrl-Click on manipulator work ok */

Which is the reason for this to fail. It's indeed quite a hack :)
Transform widgets could get an own operator handler I guess... did you have plans for that, or is it a nice one for my todo later?

Martin Poirier (theeth) added a comment.Via Old WorldJun 20 2011, 7:22 PM

The bug is in the event handling code in the window manager, not in transform.

There are other bug reports which are caused by the same issue.

What's happening is that the event passed to the invoke method of the operator has incorrect modifier flags.
In this case, the Ctrl-R press invokes the operator but the event is receives has the Ctrl flag off (as if it interpreted the release event before calling the operator).

Anthony Edlin (krash) added a comment.Via Old WorldJun 12 2012, 5:46 PM

It may have changed since it was last looked at, but right now it always has the Ctrl flag set when the R press event comes in.

The main thing that causes this behavior is 2 fold. First, ton is correct r27495 added the code that turns on snapping if ctrl flag is on when transform starts. Second, to actually get the snapping stuck on you have to first press ctrl, then press R, then release ctrl, then release R. This order of keypresses will start the bone roll when the R press event comes through, then when the release ctrl event comes through before the release R event it has a keymodifier of R and won't match the modal keymap to turn snapping off. If you use the order of press ctrl, press R, release R, release ctrl, then the release ctrl event comes through without a keymodifier of R and matches the modal event to turn snapping off, so you don't notice that snapping was ever on.

There are several ways this could be fixed:
1) Could change the matching code so that it matches control (or all modifier keys) as if they didn't have a keymodifier.
2) We could reset the keymodifier to nothing when an operator starts that uses that key.
3) We could generalize the check for ctrl (or all modifier keys) into an addition transform RNA property that is only set up/used by the manipulator (for now).
4) Could add another RNA property to transform like "snap_invert" that is a general snap property and then manipulator can check for ctrl modifier and set it.

I'm not really in favor of 1 or 2 as it's kindof a hack of event system for just this case (as far as I know).

I have a patch for 3 because it's really simple, but maybe 4 would be best as it would leave all the checks in the manipulator and make a general "snap_invert" property.

If you want the patch I can put it on codereview or write another patch for 4 and put that on codereview.

Ton Roosendaal (ton) added a comment.Via Old WorldOct 21 2012, 2:48 PM

Hi Anthony,

Thanks for checking on this (and sorry for not replying sooner).
Option '4' seems to me best though. It keeps the culprit where the issue is.

I should spend more time on it, but my impression is still that the best fix is to have the manipulators becomes a regular UI feature with operators.

Ton Roosendaal (ton) added a comment.Via Old WorldNov 2 2012, 12:12 PM

Yay, finally a bug that got fixed automatically with my event code cleaning.

Zanqdo: just poke me here if you can still redo this.

Ton Roosendaal (ton) closed this task as "Resolved".Via Old WorldNov 2 2012, 12:12 PM

Add Comment