Hi,
I would like to create maya python node that in calculation use getClosestPoint() procedure. The main problem is how to load mesh name to node. I would like to have ability to change input mesh.
ex. code in python:
import maya.api.OpenMaya as OpenMaya
import pymel.core as pm
geo = pm.PyNode('pSphere1')
loc = pm.PyNode('locator1')
pos = loc.getRotatePivot(space='world')
try:
selectionList = OpenMaya.MSelectionList()
selectionList.add(geo.name())
nodeDagPath = selectionList.getDagPath(0)
except:
raise RuntimeError('maya.api.OpenMaya.MDagPath() failed on %s' % geo.name())
mfnMesh = OpenMaya.MFnMesh(nodeDagPath)
point = OpenMaya.MPoint(pos.x, pos.y, pos.z)
space = OpenMaya.MSpace.kWorld
closestPoint= mfnMesh.getClosestPoint(point, space)
cpx = closestPoint[0][0]
cpy = closestPoint[0][1]
cpz = closestPoint[0][2]
Is there possibility to use something different than name as input ex. outMesh ? worldMesh ? So i can use it as an input channel in my node.
regards,
k.