I have error whem I try access ULandscapeSplinesComponent TrackSplines

Hi guys

I’m trying to re-write an old script to the new version of EU4 and I’m having trouble.

The first error is that: **It gives error in the first STRUCT OFFSET
**(pointer to incomplete class type is not allowed)


FInterpCurveVector& HackAccessSplineInfo(ULandscapeSplineSegment* SplineSegment)
{
    //This ugly code will crash badly if the ULandscapeSplineSegment changes
    BYTE* HackPtr = (BYTE*)SplineSegment;
#if WITH_EDITORONLY_DATA
    HackPtr += STRUCT_OFFSET(ULandscapeSplineSegment, LDMaxDrawDistance) + sizeof(uint32) * 3;
#else
    HackPtr += STRUCT_OFFSET(ULandscapeSplineSegment, Connections[1]) + sizeof(FLandscapeSplineSegmentConnection);
#endif
    return *(FInterpCurveVector*)HackPtr;
}

The second error (ULandscapeSplinesComponent* APlayerController::TrackSplines pointer to incomplete class type is not allowed) at the TrackSplines and CurrentControlPoint too.



if (GetPawn())
    {
        for (TObjectIterator<ULandscapeSplinesComponent> ObjIt; ObjIt; ++ObjIt)
        {
            TrackSplines = *ObjIt;

            ULandscapeSplineControlPoint* ClosestControlPoint = nullptr;

            //Find the controlpoint closest to the player start point
            FVector PlayerStartLocation = GetPawn()->GetActorLocation() - TrackSplines->GetOwner()->GetActorLocation();
            float ClosestDistSq = FLT_MAX;
            for (int32 i = 0; i < TrackSplines->ControlPoints.Num(); i++)
            {
                float DistSq = (TrackSplines->ControlPoints*->Location - PlayerStartLocation).SizeSquared();
                if (DistSq < ClosestDistSq)
                {
                    ClosestDistSq = DistSq;
                    ClosestControlPoint = TrackSplines->ControlPoints*;
                }
            }



bool bTrackHasErrors = false;
            OrderedSegments.Empty(TrackSplines->Segments.Num());
            ULandscapeSplineControlPoint* CurrentControlPoint = ClosestControlPoint;
            while (CurrentControlPoint)
            {
                int32 i = 0;
                for (; i < CurrentControlPoint->ConnectedSegments.Num(); i++)
                {
                    if (OrderedSegments.Num() == 0 || CurrentControlPoint->ConnectedSegments*.Segment != OrderedSegments[0])
                    {
                        OrderedSegments.Insert(CurrentControlPoint->ConnectedSegments*.Segment, 0);
                        check(CurrentControlPoint != CurrentControlPoint->ConnectedSegments*.GetFarConnection().ControlPoint);
                        CurrentControlPoint = CurrentControlPoint->ConnectedSegments*.GetFarConnection().ControlPoint;
                        break;
                    }
                }

                //We didn't find another segment to link to, we have an error!
                if (i == CurrentControlPoint->ConnectedSegments.Num())
                {
                    bTrackHasErrors = true;
                    break;
                }

                //Back to the start
                if (CurrentControlPoint == ClosestControlPoint)
                    break;
            }

This one to (class APlayerCameraManager has no member bFollowHmdOrientation)


void ARollerCoasterPlayerController::PlayerTick(float DeltaTime)
{
    //If we're requesting a stop, do it immediately
    if (Stopped)
    {
        CurrentRollerCoasterVelocity = 0.f;
    }
    else
    {
        CurrentRollerCoasterVelocity += AddVelocity;
        AddVelocity = 0.f;
    }

    if (GetPawn() && TrackSplines)
    {
        DeltaRemaining += DeltaTime;

        static float FixedStepTime = 1.f / 150.f;
        while (DeltaRemaining >= FixedStepTime)
        {
            UpdatePlayer(FixedStepTime);
            DeltaRemaining -= FixedStepTime;
        }
    }

    PlayerCameraManager->bFollowHmdOrientation = true;

    Super::PlayerTick(DeltaTime);
}

And the last one at the CurrentSegment
(ULandscapeSplineSegment8 CurrentSegment pointer to incomplete class type is not allowed)


// Calculate the roll values
    float NewRotationRoll = 0.f;
    if (CurrentSegment->Connections[0].ControlPoint && CurrentSegment->Connections[1].ControlPoint)
    {
        FVector StartLocation; FRotator StartRotation;
        CurrentSegment->Connections[0].ControlPoint->GetConnectionLocationAndRotation(CurrentSegment->Connections[0].SocketName, StartLocation, StartRotation);
        FVector EndLocation; FRotator EndRotation;
        CurrentSegment->Connections[1].ControlPoint->GetConnectionLocationAndRotation(CurrentSegment->Connections[1].SocketName, EndLocation, EndRotation);
        NewRotationRoll = FMath::Lerp(-StartRotation.Roll, -EndRotation.Roll, NewKeyTime);
    }
    NewRotation.Roll = NewRotationRoll;

Lot problemas I know but some one can help-me?

“Pointer to incomplete class type is not allowed” means you have a forward declaration of a type somewhere, but you’re missing the #include containing the actual declaration. In this case probably LandscapeSplinesComponent.h.

bFollowHmdOrientation was removed in 4.11, see VR Camera Refactor.

Thanks Mattiwatti

What is the strangest thing I did this include.
I did include these modules.


#include "Engine.h"
#include "CoreUObject.h"
#include "Engine.h"
#include "Runtime/Landscape/Classes/LandscapeSplinesComponent.h"
#include "Runtime/Landscape/Classes/LandscapeSplineSegment.h"
#include "Runtime/Landscape/Classes/LandscapeSplineControlPoint.h"
#include "IHeadMountedDisplay.h"

I think they’re going to get in the correct places. There are?

I removed BFollowHmdOrientation and rebuild and now gives me this error !!!

&stc=1

What can it be!!!

Edit your .Build.cs file and add this:

PrivateDependencyModuleNames.Add(“Landscape”);
PrivateIncludePathModuleNames.Add(“Landscape”);

And change your includes to

#include “Landscape.h”
#include “LandscapeProxy.h”
#include “LandscapeSplinesComponent.h”
#include “LandscapeSplineSegment.h”
#include “LandscapeSplineControlPoint.h”

(they might not all be necessary, experiment and find out)

Hi Mattiwatti

I’ve Got to add these lines in .Build.cs, I not tried to add Landscape.h and LandscapeProxy.h. But I will try. But after reading the documentation and get help from some users and it is because that these classes (ULandscapeSplineComponent) are marked with a tag called “MinimalAPI”.

https://docs.unrealengine.com/latest/INT/API/Runtime/Landscape/ULandscapeSplinesComponent/index.html

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/Specifiers/MinimalAPI/

This tag effectively prevents these classes from being inherited, because it forces the exclusion of the implementation/data members at compile time. Only the signatures and names are visible. This is done in order to improve compile time.
If you wish to extend these classes, you will have to download Unreal source from GitHub and compile the engine from source, and then manually strip out these tags, as the binary version of the engine that is distributed by the launcher cannot be recompiled.

I’m doing the installation source and will test, then say if it worked.

Thanks