Page MenuHome

context area/region are not updated during a modal loop
Closed, InvalidPublicTO DO


context.area and context.region don't seem to update accordingly to the mouse focus in the common case, but they will in less common cases, like switching to another screen during the modal execution, or by starting the modal from a fullscreened area then go back to normal. so it's more difficult and less reliable to know on which region is the mouse in the common case(workarounds but there's limitations). a testfile about this :

Event Timeline

This is a a feature of the operator system, operators have their callbacks executed in the context that they were started in. For typical modal operators like transform this is useful behavior, but I guess for your operator it's not. What is it that you're trying to do with this, maybe there is another solution?

What is it that you're trying to do with this
:) in the test case I used the modal template provided in blender 2.59 (the one that turns the mouse into a BGL pen) and modified it a bit to illustrate what I wrote. I didn't write odd things, (but it's true I usually like to write odd things in python) I used the modal in a 'normal' way and noticed the context area / context does not returns the same values depending on the cases above. wether it returns the attached area/region, or the mouseover area/region, it's beyond me, but it should not returns both.

I also have a concrete example of odd things I needed to do about modal at the link below. unfortunately it's not a 'sample/simple case' but a multi-module addon with lots of workarounds :
about #28970 (missing event),
real region location of the mouse pointer (UI or WINDOW)
callback_add() to out of context region ( else BGL is draw on the panel not in the window :
oddest things are in (373-382) and and line 280 if init block

Moved to todo list, the operator system simply was not designed to work this way, it would be useful to make it possible to track the context but it's not considered a bug.

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Unknown Status.Feb 1 2012, 6:54 PM