How can I get spline points selected in editor

I’m working on a plugin that alters splines in the editor, and I need to be able to adjust the points on the spline that the user has selected.

I have a ptr to the USplineComponent and can adjust all of the points, and now just need to know which ones the user has highlighted with multi-select to modify only those elements.

It seems that the FSplineComponentVisualizer has the functionality I need, but I can’t figure out a) if that’s really what I need, and b) how to get it compiled and access the visualizer that’s attached to the spline that’s being used.


1 Like

You’re going to need to do that inside the component visualizer. The selected spline points aren’t “real” objects, they’re hit proxies which will be intercepting user input in the editor and interpreting that data to manipulate the spline’s array of spline points directly.

Give this a read for how they work:

I assume your plugin already has an editor module. What you’re going to need to do is create a new FSplineComponentVisualizer, unbind the default visualizer for the spline via GUnrealEd->UnregisterComponentVisualizer in your module’s startup code and then bind your new version with the additional functionality. You might also need to tweak your plugin load order to ensure that this happens after the normal binding, but I’d expect that to probably be okay by default.


Thanks for the info. I don’t already have an editor module, but your comments helped me derive the solution that I was hoping to end up with.

For the benefit of others, I just needed to get access to the current spline visualizer to access its info. That was achieved with the following code:

TSharedPtr< FSplineComponentVisualizer > SplineVisualiser = StaticCastSharedPtr< FSplineComponentVisualizer >( GUnrealEd->FindComponentVisualizer( USplineComponent::StaticClass() ) );

1 Like

Thanks a ton for this answer !
As a side note : to be able to compile this answer, I had to :

  • Add “ComponentVisualizers” to my editor PublicDependencyModuleNames in the project’s Build.cs
  • Add some includes for the compiler to know all types and variables it’s using:
    #include “Editor/UnrealEdEngine.h”
    #include “UnrealEdGlobals.h”
    #include “SplineComponentVisualizer.h”

in case someone is looking for this