[Maya Python] Deactivating "Object Live" even if LMB is held down?

Hey TA.org,

I’m trying to write a script that allows me to draw a cube using “interactive creation” = on, and even in the midst of drawing (LMB pressed) , ~ key will disable “Object Live” status.

Python has to listen for a specific keyboard input.
(This might be threading?)

It’s something like this:

while cmds.currentCtx() == ‘CreatePolyCubeCtx’:
if user keyboard input = ‘~’: #this has to execute even if LMB is held down
disable make live

I’m not sure how to write it… to get python to listen for a keystroke

This would be similar to “while a tool is active, certain key board inputs will do certain things” regardless of mouse input.

I should mention make live doesn’t turn off while LMB is held down in Interactive creation mode, at least not using regular hotkey assignment.

If the regular hotkey can’t influence it, I doubt there is much you can do to force the issue.
In most editing contexts Maya is aggressively single-threaded and mucking with live-state like that is probably pretty damn dangerous.

1 Like