I am porting a class to c++ that contains a spline component where the spline points are added in the Construction Script. Using blueprints I added the spline component and cleared the Override Construction Script and Input Spline Points to Construction Script. I also enable the Scale Visualization Width and in the construction script I always get a two point spline and I can add or modify it. The Scale Visualization appears in pink color and I am unable to edit the spline in the editor as expected.
When I tried to migrate this to C++ I did the following:
In the constructor I added the component:
// Create Components
RootSceneComponent = CreateDefaultSubobject(TEXT(“Root Scene Component”));
SetRootComponent(RootSceneComponent);
DetailedSpline = CreateDefaultSubobject<USplineComponent>(TEXT("Detailed Spline"));
DetailedSpline->SetupAttachment(RootComponent);
DetailedSpline->bShouldVisualizeScale = true;
DetailedSpline->ScaleVisualizationWidth = 100.0;
DetailedSpline->bInputSplinePointsToConstructionScript = false;
DetailedSpline->bSplineHasBeenEdited = false;
In the OnConstruction I check the number of points in the spline and I create spline points.
int temp = DetailedSpline->GetNumberOfSplinePoints();
// Add spline points.
When I run the C++ version, the spline points are editable in the editor (the Scale Visualizer appears white as well). When the construction function is called, the previous points are passed to the spline.
How can I create a spline component in C++ that is created in the construction function and cannot be edited in the editor?
Thanks