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


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



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 :)

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. ;)

wait, got it!

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


I've tracked it down to this commit:

/* 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?

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).

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.

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.

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.Nov 2 2012, 12:12 PM