Extending the Curve Editor

Hi people,

I was wondering if it is possible to extend the curve editor / asset to allow for more than it does currently.

My use case is simple enough: i want to be able to export the key frames created in the editor to be able to use them as normalized points to create splines. To do that i’d need to:

  1. Create a curve asset in the editor and save it
  2. Get the reference for the curve asset in C++ or Blueprint and from it export keyframes as an array of points (most likely using FVector2D)
  3. Pass that array of points into a spline at runtime

I plan to do it myself (if it’s possible at all), but officially having the option to get keyframes from a curve would allow users to:

  • Use the curves as more than just interpolation visualization tools (the points could be used to define splines, way points for navigation, etc)
  • Circumvent the current technical limitation of not being able to edit splines inside the blueprint viewport editor (afaik this is why it is not implemented yet)
  • You can have team members creating interesting curve shapes and saving them as assets.

So, any tips about this would be extremely helpful as i haven’t yet tried to customize the editor. Thanks!

Ok, i was precipitated to ask without thinking a little longer about the problem.

The solution was much simpler than i thought:

  1. Define your float curve asset
  2. Instead of exporting the “hardcoded” key frames, define the number of points (can be thought of as the level of precision for the curve too) you want to extract
  3. Divide your time by the number of points chosen (ideally you’ll use a normalized curve, i.e. time and value varying between 0.0 and 1.0), that’s your iteration fraction
  4. Iterate over your curve by the number of points, setting one of the vector components as the float value got from index * iteraction fraction
  5. Simply set one of the other vector components as index * iteraction fraction.
  6. For each iteration, push the resulting vector into an array
  7. Create the spline from this array of vertices

This is the general solution for my use case specifically, since i don’t need the Z axis this works well. If i had to also do something along Z i’d use another float curve and get the values over time as above. Using a vector curve could work too, but i didn’t find the visualization of this type of curve very intuitive.

Anyway, if anybody else need a simple solution for easily creating and storing splines as assets, that’ll do it!