It does the opposite.
Any MFn* class is called a “function set”, and contains functions you can use for a particular type of Maya object. Like mesh-related functions in MFnMesh. But MPx* classes are things that you the developer implement to provide Maya with data. In this case, the closestPoint function is what you implement to give Maya some idea of where the closest point is on your custom node. Your custom node could, for example, be a mesh that you generate and draw yourself. Something Maya normally does not know about or know how to query. The closestPoint method is a way for you to give Maya that missing information; presumably it would use that when snapping a Maya manipulator or pivot to a point on that custom node.
As for a quicker alternative, there are other mesh-related tools for finding points, such as MFnMesh::getClosestPoint, that has different performance/feature tradeoffs.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/931c1e30-1a92-4095-9e99-8b3bbca80cf8n%40googlegroups.com.
I don’t know much about the gpuCache node specifically, but to me it looks like exactly the kind of custom node that would require that closestPoint implementation in order for Maya to provide point snapping similar to a traditional polygon mesh; like when you hold the V key and drag the translate manipulator on the mesh. I would expect Maya to either provide a dedicated function set for operating on this particular node type, or that there simply is no way of doing it. Similar to if you were to write your own custom node and not have or provide a function set to operate on it.
Maybe there is something in the cmds module, or perhaps the native closestPointOnMesh node calls on its implementation for you? If you were to implement your own surface node, you could implement that method and put a print statement there. Then, you can see when and where Maya calls this function.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0b8fa7ec-9dcb-4ed9-97c5-0fd678a174ean%40googlegroups.com.
On 7 Apr 2023, at 5:57 pm, Marcus Ottosson <konstr...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBbEWwF0xxxp94KPuV1%3DKj9O7-wWxpkxO_hRc6CkG593A%40mail.gmail.com.