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.

On Fri, 7 Apr 2023 at 00:14, - Im3dJoe - Polygon Lab <[email protected]>
wrote:

> Hi Marcus,
> Thanks for the explanation,
> after some Google time,
> I will still require to use MFnMesh.closestIntersection,
> as I need to trace from the mouse position.
>
> do you know Is there a way to make it work for gpuCache data?
> At moment it only works with polygon mesh.
> is there a way to read gpuCache without importing it as a polygon mesh.
> gpuCache is just way more interactive in the viewport compared to mesh.
> once again thanks for sharing your knowledge.
>
> Joe
>
>
> On Thursday, April 6, 2023 at 7:59:21 PM UTC+10 Marcus Ottosson wrote:
>
>> 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.
>>
>> On Thu, 6 Apr 2023 at 10:49, - Im3dJoe - Polygon Lab <[email protected]>
>> wrote:
>>
>>>
>>> I use MFnMesh.closestIntersection a lot to get the closest point on a
>>> mesh,
>>>
>>> but I found it very slow to a dense mesh,
>>>
>>> I have been told that Quaddraw use MPxSurfaceShape::closestPoint to snap
>>> point on the gpucache, but I can not find any example of how to use it,
>>>
>>> would anyone show me a hint?
>>>
>>> cheers
>>> Joe
>>>
>>>
>>> --
>>> 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/931c1e30-1a92-4095-9e99-8b3bbca80cf8n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/931c1e30-1a92-4095-9e99-8b3bbca80cf8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/0b8fa7ec-9dcb-4ed9-97c5-0fd678a174ean%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/0b8fa7ec-9dcb-4ed9-97c5-0fd678a174ean%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFRtmOBbEWwF0xxxp94KPuV1%3DKj9O7-wWxpkxO_hRc6CkG593A%40mail.gmail.com.

Reply via email to