getUParam
Thu Sep 12 2024 07:02:52 GMT+0000 (Coordinated Universal Time)
Saved by
@eugene98
from maya import cmds , OpenMaya
def getUParam( pnt = [], crv = None):
point = OpenMaya.MPoint(pnt[0],pnt[1],pnt[2])
curveFn = OpenMaya.MFnNurbsCurve(getDagPath(crv))
paramUtill=OpenMaya.MScriptUtil()
paramPtr=paramUtill.asDoublePtr()
isOnCurve = curveFn.isPointOnCurve(point)
if isOnCurve == True:
curveFn.getParamAtPoint(point , paramPtr,0.001,OpenMaya.MSpace.kObject )
else :
point = curveFn.closestPoint(point,paramPtr,0.001,OpenMaya.MSpace.kObject)
curveFn.getParamAtPoint(point , paramPtr,0.001,OpenMaya.MSpace.kObject )
param = paramUtill.getDouble(paramPtr)
return param
def getDagPath( objectName):
if isinstance(objectName, list)==True:
oNodeList=[]
for o in objectName:
selectionList = OpenMaya.MSelectionList()
selectionList.add(o)
oNode = OpenMaya.MDagPath()
selectionList.getDagPath(0, oNode)
oNodeList.append(oNode)
return oNodeList
else:
selectionList = OpenMaya.MSelectionList()
selectionList.add(objectName)
oNode = OpenMaya.MDagPath()
selectionList.getDagPath(0, oNode)
return oNode
content_copyCOPY
to get eyelids U parameter
Comments