I am trying to use the getPointAtUV function from python, but get this error:
# 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 #
So, I must apologize for not knowing much about the python particulars of the Api, and I hope by now this has been solved, but in C++, you can check for success of function set initialization. I would check there first. If you do something like grab the transform instead of the shape, the mfnmesh will probably fail. Barring an actual check to the mstatus, you could just print the numfaces. Zero is a pretty good indication the MFN missed.
If this wasn’t your problem, I’m very interested in what it was, because I am currently toying with the idea of doing more plugin work in python instead of C++.
Cheers! -Lith
(apologies for dumb autocorrect typos, sent from phone)
I actually poked at it just now, and your code is right, but the Api is wacky. Instead of returning mstatus failed on a miss, the python api throws an exception if the uv is not within the face. All maya is trying to do is tell you it couldn’t find anything. It looks like you need to manually try/catch this, and make sure you’re on the right face. The good and bad news is that your original code is perfectly valid.