Page MenuHome

Python - operator called by gizmo always called the invoke() from the combination ALT + LEFTMOUSE (also asserts)
Confirmed, NormalPublic

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.87

Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 12:23, hash: rB82e3bd4bbb82

Short description of error
When an operator is called by a gizmo, the combination of the event ALT or CTRL or SHIFT + LEFTMOUSE always initialize the operator by calling the invoke().
Other combination of keys + LEFTMOUSE does not call the invoke()
This problem makes impossible to take into account the industry compatible keymap in the 3dview with the target_set_operator in gizmo.

Exact steps for others to reproduce the error
Open the file gizmo_operator_invoke.blend

  • Toggle the system console to view the prints
  • Run the script :
    • In the 3dView, click once on the gizmo (gizmo now follows you mouse)
    • now press Alt and start clicking -- using the combination ALT+LEFTMOUSE will call invoke() [inspect in the console] each time
      • use RIGHTCLICK or ESC repeatedly to stop the modal (if you clicked multiple times you have to do RMB multiple times as well )
    • now press S and start clicking -- use the combination "S"+LEFTMOUSE will not call invoke() [inspect in the console] each time
      • use RIGHTCLICK or ESC a single time to stop the modal

Note: in a Debug build, an Assert should be triggered when pressing Alt and start clicking

BLI_assert failed: source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c:1068, wm_gizmomap_modal_set(), at 'gzmap->gzmap_context.modal == ((void *)0)'

Thanks for your help

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from User.Jun 23 2020, 2:18 PM

use the combination "S"+LEFTMOUSE

First of all, I am getting this

Error: Traceback (most recent call last):
  File "/gizmo_operator_invoke.blend/Text", line 53, in modal
  File "//scripts/modules/bpy_types.py", line 713, in __getattribute__
    return super().__getattribute__(attr)
AttributeError: 'ModalOperator' object has no attribute 'lmb'

But even if I change the script to get rid of the error like so

I am seeing the INVOKE for both cases ("S"+LEFTMOUSE as well as ALT+LEFTMOUSE)

Am I doing something wrong?

Well that's strange.. This is what happening to me with a Blender in factory settings :

  • First, I I use ALT+LEFTMOUSE, you can see the invoke is called every times, I need to RIGHTCLICK multiple times to cancelled the modal.
  • Then I use S+LEFTMOUSE multiple times but you can see that the invoke is called only one time.

This is happening to me with the latest build of 2.9 too.

Thank you for taking the time @Philipp Oeser (lichtwerk) !

Philipp Oeser (lichtwerk) changed the task status from Needs Information from User to Needs Triage.Jul 6 2020, 10:35 AM
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Nov 23 2020, 4:56 PM

Sorry this has been lying around for so long!

Checked this again now, and I can reproduce (will update the report description a bit to make it more obvious)

Philipp Oeser (lichtwerk) renamed this task from Python - operator called by gizmo always called the invoke() from the combination ALT + LEFTMOUSE to Python - operator called by gizmo always called the invoke() from the combination ALT + LEFTMOUSE (also asserts).Nov 23 2020, 5:04 PM
Philipp Oeser (lichtwerk) updated the task description. (Show Details)
Julian Eisel (Severin) changed the task status from Confirmed to Needs Information from User.Feb 1 2021, 8:19 PM

I can't recreate this in current master, maybe I'm misunderstanding. Is this issues still happening?

Philipp Oeser (lichtwerk) changed the task status from Needs Information from User to Confirmed.Fri, Feb 19, 3:45 PM

I can't recreate this in current master, maybe I'm misunderstanding. Is this issues still happening?

Yep, I am still getting the assert in a debug build

Note: in a Debug build, an Assert should be triggered when pressing Alt and start clicking