Hi all,

I am trying to use the getPointAtUV function from python, but get this
error:

Code:

# Error: (kFailure): Object does not exist
# Traceback (most recent call last):
#   File "<maya console>", line 23, in <module>
#   File "<maya console>", line 20, in UvCoordToWorld
# RuntimeError: (kFailure): Object does not exist #

The code is this:

Code:

import maya.OpenMaya as mayaSDK
import maya.cmds as maya

def GetDagPath(nodeName):
    sel = mayaSDK.MSelectionList()
    mayaSDK.MGlobal.getSelectionListByName(nodeName, sel)
    dp = mayaSDK.MDagPath()
    sel.getDagPath(0,dp)
    return dp

def UvCoordToWorld(U, V, mesh):
    mfnMesh = mayaSDK.MFnMesh(GetDagPath(mesh))
    numFaces = mfnMesh.numPolygons()
    WSpoint = mayaSDK.MPoint(0.0,0.0)

    util2 = mayaSDK.MScriptUtil()
    util2.createFromList ((U, V),2)
    float2ParamUV = util2.asFloat2Ptr()

    mfnMesh.getPointAtUV(0, WSpoint, float2ParamUV,
mayaSDK.MSpace.kWorld)

    return WSpoint

f = UvCoordToWorld (0.5, 0.5, 'lowreshead')
print [f[0], f[1]]


Anyone knows how to do this properly. Maya python is very annoying.




Thanks,
Light
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to