Created
September 8, 2016 06:04
-
-
Save oglops/bb7c8659f66d7b8719a6514230f4859b to your computer and use it in GitHub Desktop.
test middle mouse dragging event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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