Skip to content

Instantly share code, notes, and snippets.

@oglops
Created September 8, 2016 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oglops/bb7c8659f66d7b8719a6514230f4859b to your computer and use it in GitHub Desktop.
Save oglops/bb7c8659f66d7b8719a6514230f4859b to your computer and use it in GitHub Desktop.
test middle mouse dragging event
import maya.OpenMaya as om
import maya.cmds as mc
from PyQt4 import QtCore, QtGui
callbacks = []
def do_something(*args):
if QtGui.qApp.mouseButtons()==QtCore.Qt.MidButton:
print "anything",mc.currentTime(q=1)
def main():
global callbacks
idx = om.MDGMessage.addTimeChangeCallback(do_something)
callbacks.append(idx)
def remove_callbacks():
for call in callbacks:
om.MMessage.removeCallback(call)
main()
remove_callbacks()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment