Mouse position when Tool Data inactive?



  • On 16/04/2016 at 09:32, xxxxxxxx wrote:

    Hello all,

    I've found quite a few posts on querying mouse position, but the only reliable things seem to be the ToolData's MouseInput() and gui's GetInputState().  In my case, the problem with the former is that you can only call it while that tool is active, and the problem with the latter is I can only get it to return True when I'm holding down a mouse button, not when I only click once.

    My end goal is to shoot a ray on left mouse button down like a ToolData might, but while, say, the live selection or move tool is active, and this first step is just me trying to get the mouse position.

    Thanks in advance for any advice!  If any of this doesn't make sense, lemme know :)



  • On 18/04/2016 at 10:38, xxxxxxxx wrote:

    Hi,

    I'm afraid, what you are trying to do, is impossible in Python.
    It partly is a conceptual thing. In general you need to write a ToolData plugin to get control over the viewport and mouse input (as you already know and wrote). And you can not (and are not supposed to) interfere with other tools.
    Having said this, I'll now tell the opposite. In the C++ SDK there is something called a SceneHook (not available in Python SDK), which offers means to do something like this. Yet, it is recommended to behave nicely, with the provided powers.



  • On 18/04/2016 at 11:01, xxxxxxxx wrote:

    Ah--thanks very much, as usual, Andreas :)


Log in to reply