Home Technical Talk

Eye Rig Script Problem

OrdinaryOddBall
polycounter lvl 4
Offline / Send Message
OrdinaryOddBall polycounter lvl 4
So I'm using this video tutorial series:  to make a Cartoon eyeLid rig. 

Here's the Script I'm using:
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

sel = cmds.ls(sl =1 )
crv = "curveShape1"
for s in sel :
    pos = cmds.xform(s ,q = 1 , ws = 1 , t = 1)
    u = getUParam(pos , crv)
    name = s.replace("_LOC" , "_PCI")
    pci = cmds.createNode("pointOnCurveInfo" , n = name )
    cmds.connectAttr(crv + '.worldSpace' , pci + '.inputCurve')
    cmds.setAttr(pci + '.parameter' , u )
    cmds.connectAttr( pci + '.position' , s + '.t')

Each time I run the script I get this error: # Error: line 1: RuntimeError: file S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py line 10923: (kInvalidParameter): Object does not exist

I have no idea what's going on and I tried running this on multiple computers. Any help would be appreciated. And If I could get a response as soon as possible that would be great. Thank you for any help

Sign In or Register to comment.