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

Hey there, is there any possibility of making the spline save at all ? mine seems to reset to default after moving.

EDIT:
Cancel that, I’d previously moved this over to the construction script.

Thanks mates.

Can such spline be used with SplineMesh components?
I’ve got the spline I need but I can’t translate its shape to the SplineMeshes correspondingly. Do they use different tangent formats?

Hey all,
I thought this was a rather difficult way of doing this, so I made another tool which copies the T3D of the spline from Max
Only works with open splines and only one spline per shape for one shape, but I’ll continue to iterate on it.

You can find it HERE.

Any suggestions/requests are welcome either on github or in PM.
Issues are less welcome but please tell me if you find any

Credit goes to for most of the math

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()


So why is it not possible to use the data table as variable? is this gonna be supported?

Given that FBX supports splines, is there any we can just get a simple FBX spline path importer?

My thoughts exactly. Splines are extremely beneficial and since Unreal Engine doesn’t really have native modeling tools, it should support a larger array of importing objects from 3rd party programs. Especially splines.

This video is a nice workaround, but quit an extensive hack when multiple custom splines are necessary. In my case, I have a real-world parking lot but Im using Unreal’s landscape. Works great, but the parking lines are custom and already placed in 3d as splines. But they’re not conformed to the elevations set in Unreal’s landscape. If I could easily import these splines into Unreal and give it shape, that would be awesome. Definitely not easy with this hack.

I hope a solution is released soon! 4.21???

So… About those spline imports…

Yes, I’d love to hear something new too

Hey Alan!
First of all, I’m new to Unreal and your Livestream was incredibly useful for a neuroanatomy education app that I am working on. So thank you very much!

I am wondering if this method can be used to create a spline and spline mesh. I have a JSON file formatted thusly:

"controlPoints":
{"controlPointSpline":
{"x": 2.4918339252471924,"y": 0},
{"x": 1.2459168434143066,"y": 2.1579916477203369},
{"x": -1.2459170818328857,"y": 2.1579914093017578},
{"x": -2.4918339252471924,"y": -2.178430378307894e-07},
{"x": -1.2459167242050171,"y": -2.1579916477203369},
{"x": 1.245917797088623,"y": -2.1579909324645996}],
"point": {"x": 287.01492309570312,"y": 100.07234954833984,"z": 405.66363525390625},
"up": {"x": 0.49748080968856812,"y": 0.8660818338394165,"z": 0.049125999212265015},
"vAxis": {"x": 0.23029391467571259,"y": 0.958656907081604,"z": -0.16715794801712036}}],

#lots of controlPoints in sequence.

}```

"point" is in world space, and everything else is local to "point"

"point" is a control point of the spline, and the XY values above it are the boundary points that make up an irregular shape in a 2D plane relative to the "point" to ultimately create a spline mesh.
"up" is the tangent used to create the u axis of the boundary shape.
"vAxis" is the tangent used to create the v axis of the boundary shape.

Can I use this data to generate a spline and an associated spline mesh using a derivative of your blutility?

Hey, Have been following the tutorial, but it has some trouble with curves…said in the video that there was some math error, and swipped to another project to show how it propertly works, but did not explain what was wrong and now I am experiencing that issue…
Can Anyoone please explain what was wrong in the maths? thought was the final part of the tangents but not sure the exact point

Link to script file from video description is broken. Can your fix it?

Hi,
If you follow the video in youtube (Spline Importing | Live Training | Unreal Engine - YouTube), on comments user [Burton Posey] posted the following: Alan, I think I have found the solution to the issue you were having before you had to load up a different version of your project. I was getting the same results in my workthrough. After tinkering with this for several hours and not understanding why the results weren’t right (the circle looked just like it does at 23:10 and even with the Unreal logo), I realized the out handle data needed to be multiplied by -3 instead of 3. I’ve also got a rough version of an Adobe Illustrator exporter that works with this as well I’ll post when I have time.

Hope this helps
For instance, if someone could reupload the script…

Link to the Blender Curves To Unreal Engine Splines Importer updated.

Does anyone have a working version of any script for 3ds to Unreal? Not sure how to execute defrost256’s script that outputs. I’ve tried naming it as a .py and running it from the Python Command Line to no avail.

Cheers!

1 Like

Use the blender one, it is working fine. I am wondering if there is a possibitilies to make it open spline instead of closed spline.

Does anyone have a working 3dsmax script for 2022 or later?

I cant believe its 2023 and we still aint got spline imports… wtaf.

2 Likes