如何在maya python中返回绘制光标的ws x​​yz位置?

时间:2017-04-11 13:58:52

标签: python maya maya-api

我希望能够在绘制重量时将相机聚焦在maya绘制光标周围。 我需要抓住光标的XYZ位置让我这样做,有谁知道我怎么能得到这个?

enter image description here

1 个答案:

答案 0 :(得分:1)

在maya python小组中有这样的讨论。这是link,而你需要的代码片段

from PySide import QtGui, QtCore

def print_mouse_position():

    point = QtGui.QCursor().pos()
    print "x: %s; y: %s" % (point.x(), point.y())

timer = QtCore.QTimer()
timer.setInterval(1000.0 / 25)  # Print 25 times per second
timer.timeout.connect(print_mouse_position)
timer.start()

#when ever you want to stop it uncomment below line
#timer.stop()
相关问题