1

I want to be able to focus the camera around the maya paint cursor while painting weights. I need to grab the XYZ position of the cursor for me to do this, does anyone know how i can get this?

enter image description here

Adam Sirrelle
  • 357
  • 8
  • 18

1 Answers1

1

There is a discussion happened before like this in maya python group. Here is the link and snippet down is what you looking for

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()
Achayan
  • 5,720
  • 2
  • 39
  • 61
  • Thanks, I'll certainly give that a go! I was hoping for a way to retrieve feedback on Maya's native brush tool though. Wondered if there was a way of grabbing that :\ – Adam Sirrelle Apr 12 '17 at 09:14
  • Ah, that's cool, but this is for returning the X and Y in the monitor's 2D space. I was hoping for a way to retrieve feedback on Maya's native brush tool's XYZ in 3D world space. :) – Adam Sirrelle Apr 12 '17 at 09:20
  • Oh in that case you can user draggerContext http://help.autodesk.com/cloudhelp/2017/CHS/Maya-Tech-Docs/Commands/draggerContext.html much easy – Achayan Apr 14 '17 at 23:37