Multiple viewports screws up MouseOver

To be more precise, I have 4 viewports (its actually two but each with an overlay).
The problem is when I do “getRaySource()” it returns the source of a different viewport than the one which I have the mouse over.

Here’s my exemple blend, press P over the 3D viewport and move the cursor from the upper viewport to the bottom viewport…

is it a bug or am I missing something?

Also I’m using 2.49

Attachments

default.blend (346 KB)

no dont think so, you might have to create 2 sets of scripts for each scene.

Hum… could you elaborate more please?

im not a python person but try making another script and using that instead (for all of the scripts)

Ok obviously you dont get what the problem is, I checked over and over and this really does look like a bug.
the .raySource property of the MouseOverAny sensor returns the raySource of the wrong viewport (no the same viewport as the mouse is positioned on). So when you put the mouse at the bottom of the second viewport, the custom cursor is set to the bottom of the first viewport and same ViceVersa.
The worst is that I can’t find any fix or workaround :frowning:

Seems like a bug to me.

A workaround idea:

If the camera that it picks is predictable, you could subtract that camera’s position and multiply by its orientation matrix, then get the mouses 2d position to determine which view port it is on and add that cameras position and orientation matrix to the vector

Something like this:

from Mathutils import Matrix, Vector

aVector=Vector(mSensor.raySource())-Vector(theCameraThatItPicks.worldPosition) #removes camera's position.
aVector=aVector*Matrix(theCameraThatItPicks.worldOrientation) #removes camera's rotation.
aVector=Matrix(cameraThatTheMouseIsOver.worldOrientation)*aVector #adds proper camera's rotation.
realRaySource=aVector+Vector(cameraThatTheMouseIsOver.worldPosition)#adds proper camera's position.

Ya, that code is really bad, but it gives you the idea.

Thanks a lot littlebob! it’s a bit of a hacky way to do it but it works! I hope the devs are looking forward to fix this bug tough…

Here’s the working blend.

Attachments

default.blend (347 KB)

its a bug looking into it

fixed in svn http://lists.blender.org/pipermail/bf-blender-cvs/2009-June/019795.html will be in 2.49a release