Training Stream - Spline Importing w/ - Jan 10th - Live from Epic HQ

It is possible to have this code work on multiple actors with spline components. Remove the spline component from your blutility. Create a new actor with a spline component. Add an editable actor reference variable to your blutility. Now you can get a reference to different actors with spline components. In the blutility take the actor reference and check if it has a spline component, if so execute the blutility on that spline component.

This is my current pymel script. i will refine it with ui and such but this will get you going.
My script only works on bezier curves atm. You can convert a bezier curve to a nurbs one through menu modify->convert.
This also means you get one vector tangent instead of an in and out tangent. You have to account for this in the blueprint by using the set tangent node instead of set tangents. You can uncheck the ‘allow discontinuous spline’
Just change the file path and make sure you run it in the python script tab instead of the mel one.



import pymel.core as pm
import maya.cmds as mc
import csv
#select the curve and call 
sel = pm.selected()
crv = sel[0].getShape()

def getBezierCVPosAndTan():
     
    cvLocs = ]
    cvTans = ]
    cv=0
    while (cv <= (crv.numCVs()-1)):
        #get CV position
        cvLoc = crv.getCV(cv)
        cvLocs.append(cvLoc)
        #get param at position
        cvParam = crv.getParamAtPoint(cvLoc)
        #get tangent at param
        cvTan = crv.tangent(cvParam)
        cvTans.append(cvTan)
        #maya sees the tangent handles as CV's, we skip those
        cv = cv+3
    return cvLocs,cvTans
    
cvLocations,cvTangents = getBezierCVPosAndTan() 


path = "D:/Esther/Assets/"
filename = "curveCSV.csv"
filePath = path+"/"+filename
print filePath
with open(filePath,"wb") as csvFile:
    writer = csv.writer(csvFile,quoting=csv.QUOTE_MINIMAL)
    writer.writerow(("","Position","Tangent"))
    for cv in range(0,len(cvLocations),1):
        #extract the position and tangent data and save in correct format
        #we swap some axis around to make the maya coordinates fit with the unreal ones.
        writer.writerow((cv,"(X="+str(cvLocations[cv][0])+",Y="+str(cvLocations[cv][2])+",Z="+str(cvLocations[cv][1])+")","(X="+str(cvTangents[cv][0])+",Y="+str(cvTangents[cv][2])+",Z="+str(cvTangents[cv][1])+")"))

csvFile.close()