Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    link to [countdown] absent

    Comment


      #17
      Hey all, I have attached the shape files, the macroscript, and the SplineWriter graph.

      If you've watched the stream and saw the part where the circle comes in incorrectly, the issue was found in that the last node of the graph should be set to local, and the World to Local conversion on the out tangent was swapped. The file contains the corrected version.
      Attached Files

      Comment


        #18
        Thank you very much, a great lesson.
        I started doing this in the Blender.

        Code:
        import bpy
        
        ob = bpy.context.object
        assert ob.type == 'CURVE'
        
        curve = ob.data
        spline = curve.splines.active
        assert spline.type == 'BEZIER'
        
        scale = 100.0
        
        id = 0
        print ("---,InVal,OutVal,ArriveTangent,LeaveTangent")
        for p in spline.bezier_points:
            print ('%i,"%f","(X=%f,Y=%f,Z=%f)","(X=%f,Y=%f,Z=%f)","(X=%f,Y=%f,Z=%f)"' % (id, float(id), p.co[0]*scale, p.co[1]*scale*-1, p.co[2]*scale, p.handle_left[0]*scale, p.handle_left[1]*scale*-1, p.handle_left[2]*scale, p.handle_right[0]*scale, p.handle_right[1]*scale*-1, p.handle_right[2]*scale))
            id = id + 1

        I made a different structure, removed the float vector added
        Everything works fine, except for the positions Handley
        I do not understand is how it works.
        I will be glad prompts.

        Comment


          #19
          Archive is up now
          Twitch /unrealalexander| Twitter @UnrealAlexander
          How to report a bug? | Installation & Setup issues?
          Call me to a thread by posting this: [MENTION]Alexander Paschall[/MENTION]

          Comment


            #20
            Originally posted by Alexander Paschall View Post
            Archive is up now
            I just got done watching and its great stuff I really like how this is something people can implement themselves, I hadnt even considered scripting in Illustrator honestly so this really shows how abit of different thinking can find a solution that works around the engines limitations. I do hope the conversation around splines and a proper specialized datatype continues at Epic, as AlanNoon said they are a very versatile tool which could open alot of doors

            Comment


              #21
              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.

              Comment


                #22
                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?

                Comment


                  #23
                  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 Alan Noon for most of the math
                  Last edited by defrost256; 01-23-2017, 09:11 AM.

                  Comment


                    #24
                    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.

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

                    Comment


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

                      Comment


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

                        Comment


                          #27
                          Originally posted by Antidamage View Post
                          Given that FBX supports splines, is there any chance 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 Max 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???
                          Eldridge Felder

                          Animation/Visualization Manager
                          WorthGroup Architects

                          Comment

                          Working...
                          X