Page MenuHome

Toggling snapping during transform does not update header icon
Open, Confirmed, LowPublic


Broken: 2.81, 2.82

Short description of error
If during a transform you use the modal shortcut to toggle snapping, the snapping icon in the header will not update its state, even after the transform is confirmed or cancelled. It will update if you hover mouse pointer over it though.

Exact steps for others to reproduce the error

  1. Load the default scene.
  2. Start moving the cube and press the snap toggle shortcut (shift+tab in default keymap)
  3. Complete or cancel the transform.
  4. Hover mouse pointer over the snap icon in the header.



Related Objects

Event Timeline

Hi, thanks for report.

Can confirm that it doesn't update button drawing until you hover over.

saveTransform saves the snap state back to the toolsettings but doesn't force any redraw. If I add a ED_area_tag_redraw then it updates as it should, but not sure if we should use that or other transform redraw functions.

Philipp Oeser (lichtwerk) lowered the priority of this task from Needs Triage by Developer to Confirmed, Low.Mon, Dec 2, 5:18 PM

@Anthony Edlin (krash): I guess that would work. This is doing it after confirmation/cancellation, right? Do you have a way to redraw immediately, too?

CC @Germano Cavalcante (mano-wii)

@Philipp Oeser (lichtwerk) I look into transfering setting back into toolsettings right in the modal event handling of TFM_MODAL_SNAP_TOGGLE with this patch:

It kind of works, but in doing this I run into a bunch of problems, plus expanded scope of this bug.

  1. Toolsettings and transform are used by many editors including nodes editor, video sequencer, UV editor, 3d view. If I redraw in the 3d view the button for snapping it still doesn't redraw the ones on other editors until you hover over their areas. So what to do, update whole interface? Is there some notifier for when toolsettings changed that could be used? Some editors like sequencer use snapping but toggle doesn't do anything in that editor but it will toggle the other editors snapping, so have to check which editors it's useful for.
  1. It's not just snapping that has this problem. If you have proportional editing turned on you can press shift+O to toggle falloff type and alt+C to toggle connected inside transform operator. If you do either of these they have same problem as snapping toggle, the buttons in header only update once you hover over it. Same for UV editor proportional edit buttons.
  1. There are some weird transform options you can set in 3d view that don't really make sense and transform operator kind of just ignores in some cases. You can turn transform affect off for all of Move, Rotate, and Scale but you can still have snapping on? If you have only affect move toggled on with snapping on and you start a move with G but then switch to rotation with R, snapping is still on, even though settings has it off for rotation. With same settings if you start a rotation with R, snapping won't be on, then you press G and it will be on, then you press R and it's still on. So are settings just what a transform should start with and then can toggle if you want or? Seems right now you can toggle some and they are saved but some others and they are not saved. We don't save if you switch from global to local orientations.

So there are several things that need to be fixed here but I'm not sure anymore what is correct. To update the toolsettings dynamically from modal events? To only save out toolsettings at end in saveTransform and update whole interface? To not save out toolsettings because it just messes around with defaults? A mix of different options based on what toolsetting it is? Maybe UI team has a consensus here?

Is there some notifier for when toolsettings changed that could be used?

we could do

3diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
4index 74fc1406795..c2be9b7ef20 100644
5--- a/source/blender/editors/transform/transform.c
6+++ b/source/blender/editors/transform/transform.c
7@@ -2172,6 +2172,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
8 else {
9 ts->snap_flag &= ~SCE_SNAP;
10 }
11+ WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
12 }
13 }

(but that only kicks in on confirmation/cancellation as well -- maybe it is OK though, better than nothing)
Havent checked the other stuff, might have time tomorrow...

@Philipp Oeser (lichtwerk) Yes I think this is probably the best solution for now. ND_TOOLSETTINGS at least will update multiple headers and not whole areas. You will want to do something similar just above that code were it saves out proportional editing toolsettings also. At least now the button display will not be stale.

I'm still not sure how I feel about saving these settings outside of transform but not other settings. It's kind of weird now it only saves it out if the transform mode matches the snapping affects move, rotate, or scale is on. By the default of only affect move being on for snapping, if you press G first and then R to switch to rotation and then shift+TAB to turn on snapping it will snap in the transform operator but it will not save it out. I guess it's always been that way so people are used to how it works, or it just doesn't matter that much.