import maya.OpenMaya as om
import maya.OpenMayaUI as omui
def get_view_position(pos):
# 传入一个三维数组
view = omui.M3dView.active3dView()
x_ref = om.MScriptUtil()
y_ref = om.MScriptUtil()
x_ptr = x_ref.asShortPtr()
y_ptr = y_ref.asShortPtr()
view.worldToView(om.MPoint(pos), x_ptr, y_ptr)
vectorx = x_ref.getShort(x_ptr)
vectory = y_ref.getShort(y_ptr)
return(vectorx, vectory)
上一篇
maya开发配置VS
2024-05-10
下一篇
api命令
2024-05-10