missing event in modal() pass_through mode when a "builtin modal" is already attached #28970

Closed
opened 2011-10-19 10:44:20 +02:00 by Jerome Mahieux · 5 comments
Member

%%%while executing the modal() using PASS_THROUGH, I also noticed that some events can disappear if they are catched by another (builtin) see attached file for test case.
example :
in image_editor, when an image is displayed, MOUSELEFT PRESS is catched by a py modal
the event is catched by the builtin "x y mouse and pixel values black bar" that appears at the bottom of WINDOW IMAGE_EDITOR.
but MOUSELEFT RELEASE can't be seen from the python modal

  • then you can't write a drag function using a simple code.

maybe a call to temporary freeze a builtin or any other modal execution, or an is_there_an_area_callback_here() call would be useful when in pass_through mode.

maybe it's related to the followinf undocumented items :
bl_options BLOCKING or GRAB_POINTER switches,
and operator call 'EXEC_..' and 'INVOKE...' arguments other than the '_DEFAULT' that seems to pass context childs directly to the op.%%%

%%%while executing the modal() using PASS_THROUGH, I also noticed that some events can disappear if they are catched by another (builtin) see attached file for test case. example : in image_editor, when an image is displayed, MOUSELEFT PRESS is catched by a py modal the event is catched by the builtin "x y mouse and pixel values black bar" that appears at the bottom of WINDOW IMAGE_EDITOR. but MOUSELEFT RELEASE can't be seen from the python modal - > then you can't write a drag function using a simple code. maybe a call to temporary freeze a builtin or any other modal execution, or an is_there_an_area_callback_here() call would be useful when in pass_through mode. maybe it's related to the followinf undocumented items : bl_options BLOCKING or GRAB_POINTER switches, and operator call 'EXEC_..' and 'INVOKE...' arguments other than the '_DEFAULT' that seems to pass context childs directly to the op.%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

%%%The problem is that when you start the modal operator, it's at the first in the list to get an event passed in. However when the color sample operator starts, it also starts a modal operator, and it's put in the list before your operator. It will swallow the key release event, and this is the right thing to do because other operators shouldn't act on that key release.

What you need is the ability to keep your operator as the first in the list to receive events, regardless of any other modal operators. There would be two ways to implement this, add another level above screen to run operators at, or add an option to keep the operator on the first place in the list.%%%

%%%The problem is that when you start the modal operator, it's at the first in the list to get an event passed in. However when the color sample operator starts, it also starts a modal operator, and it's put in the list before your operator. It will swallow the key release event, and this is the right thing to do because other operators shouldn't act on that key release. What you need is the ability to keep your operator as the first in the list to receive events, regardless of any other modal operators. There would be two ways to implement this, add another level above screen to run operators at, or add an option to keep the operator on the first place in the list.%%%
Author
Member

%%%it seems a way already exists, since the color sample modal() is disabled or at least not triggered, when the python modal() returns RUNNING_MODAL rather than PASS_THROUGH. any event is received by the python modal and everything is fine when running the modal this (exclusive) way.

the last 'running_modal' modal() started seems to be on 'the first place in the list.'

maybe in future, from a larger point of view I would need to know what is actually running as a callback in a given area, before to run my own ?
a test call from invoke() or a handler_add control ? considering the growing number of addons with their own modal BGL functions shipped, any existing modal instances, builtin or addon ones, should be available in the bpy one day.. in context ? maybe they already are, actually I don't find them and maybe I'm wrong.%%%

%%%it seems a way already exists, since the color sample modal() is disabled or at least not triggered, when the python modal() returns RUNNING_MODAL rather than PASS_THROUGH. any event is received by the python modal and everything is fine when running the modal this (exclusive) way. the last 'running_modal' modal() started seems to be on 'the first place in the list.' maybe in future, from a larger point of view I would need to know what is actually running as a callback in a given area, before to run my own ? a test call from invoke() or a handler_add control ? considering the growing number of addons with their own modal BGL functions shipped, any existing modal instances, builtin or addon ones, should be available in the bpy one day.. in context ? maybe they already are, actually I don't find them and maybe I'm wrong.%%%

%%%Moved to todo list, the operator system simply was not designed to work this way, it would be useful to make it possible to have an operator that can capture all events no matter what other operator is executed, but it's not considered a bug.
http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#Undo.2C_Redo_and_Operator_Context%%%

%%%Moved to todo list, the operator system simply was not designed to work this way, it would be useful to make it possible to have an operator that can capture all events no matter what other operator is executed, but it's not considered a bug. http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#Undo.2C_Redo_and_Operator_Context%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#28970
No description provided.