Maya: Detect Alt / LMB (tumble tool) event

I’m trying to figure out a way to capture as an event, when the artist goes into tumble mode in the perspective viewport when Alt and Left Mouse button is clicked.

I’ve looked through the list of events in the scriptJob command, and can’t see anything which looks like it fits the bill. Unfortunately, the ‘ToolChanged’ event for eg. does not trigger when switching to the tumble tool via Alt / LMB. There is also ‘DragRelease’ but this is no good to me as I want to get something more like ‘DragEnabled’, that fires at the beginning of the drag.

I also can’t see a way to check if a specific keypress combination has happened.

Any tips would be greatly appreciated :slight_smile:

Cheers

Maya really really wants you to write a plugin and a context to get to MEvent.

If that isn’t what you need, you can easily query the interaction state, but it’s difficult to set this up to be useful outside of a plugin.

import maya.api.OpenMayaRender as omr
omr.MFrameContext.inUserInteraction()
omr.MFrameContext.userChangingViewContext()

Depending on what you are trying to do, you might be able to build off of the draw events from a simple locator.

There is also this example for a render override that from the looks of it, fires every frame. You could probably strip out all of the other print statements and just call .inUserInteraction() or .userChangingViewContext().

Hi Zach! (sorry to reply to this so late). Just wanted to say thanks for the response, definitely some stuff to chew on, though I have little experience with plugins. Also unfortunately it looks like the MEvent is not recognising ALT button presses (though does recognise SHIFT and CTRL keys).

But anyway, I will follow up these leads- thanks again!