I commented on your gist but I'll add here just in case you don't check that often:
The problem with this code is specifying your world space as a string value. It requires an integer and for maximum future proofing you should use the pre-defined one from the api: OpenMaya.MSpace.kWorld Feed that into your second argument instead of "world" and assuming that you've iterated through the faces correctly, it should return the correct result. Help on built-in function getUVAtPoint: getUVAtPoint(...) getUVAtPoint(point, space=MSpace.kObject, uvSet='') -> (float, float, int) Returns a tuple containing the u and v coordinates of the point on the mesh closest to the given point, and the ID of the face containing that closest point. On Tuesday, March 14, 2017 at 2:14:04 PM UTC-4, thirstydevil wrote: > > Just tried it, works like a charm. I guess that when you've used > follicles so so long you don't look else where. Doesn't solve the issue > above but if it's solid I'll swap the code out to this function call. > > Thanks Ian! > > -Dave > > On Tue, Mar 14, 2017 at 5:43 PM, Ian Waters <[email protected] > <javascript:>> wrote: > >> Hey Dave, >> >> Not a solution to your problem, but did you try the Surface Attach tool >> that comes with Maya Muscle? We’ve found it to be a lifesaver. >> Deform > Muscle > Bonus Rigging > Surface Attach >> >> Worth a shout :) >> Ian >> >> On 14 Mar 2017, at 17:40, thirstydevil <[email protected] >> <javascript:>> wrote: >> >> So I've been having issues today with all types of rivet scripts, the >> closets point on poly node or anything that is essentially using >> maya.OpenMaya.MSpace.getUVAtPoint >> >> If I run the below just once I get [0,0] as the uv position. If I run it >> several times it will eventually return the correct result. Maya 2017 >> update 3. >> >> Anyone experiencing this, is it normal? >> >> https://gist.github.com/thirstydevil/817c335c356e8c231d35fc013f654bfd >> >> -Dave >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/cc04ad67-2c28-4e30-bb4d-d9766ac4c6db%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/cc04ad67-2c28-4e30-bb4d-d9766ac4c6db%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/1561608D-5354-4611-9867-D8716AA374CB%40gmail.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/1561608D-5354-4611-9867-D8716AA374CB%40gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > *David Moulder* > Technical Animator / Artist > [email protected] <javascript:> > *Professional Profile <http://uk.linkedin.com/pub/david-moulder/1/b12/b5a>* > > Mobile: +44 (0)7814033242 > See who we know in common > <http://www.linkedin.com/e/wwk/5748982/?hs=false&tok=3tztwkse1silw1> Want > a signature like this? > <http://www.linkedin.com/e/sig/5748982/?hs=false&tok=3pwLU9-mBsilw1> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b18c1685-48ef-470d-83b5-142db540c2c3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
