C++ Transition Guide for 4.26

Dear Community,

4.26 is heeere!

Woohoooo!

This is a thread where you can ask questions about the 4.26 upgrade process, or post your findings as you succeed at doing this yourself!


DeveloperSettings Module

If you use UDeveloperSettings for your plugins or games then you now need to include this in your build.cs:



```



PublicDependencyModuleNames.AddRange(
  new string] {
    "Core",
    "CoreUObject",
    "Engine",
    "InputCore",
    "DeveloperSettings"            <<~~~~~~~~~~~~~~~
  }
);


```



♥

Rama
3 Likes

**UCameraShake **is now called **UMatineeCameraShake **which inherits from UCameraShakeBase

I had to include PhysicsCore as a dependency when using UPhysicalMaterial.

Also the header include for UPhysicalMaterial changed to


 #include "PhysicalMaterials/PhysicalMaterial.h"

Able touches a lot of systems, so I have a pretty good list (the CameraShake has already been called out by Kaidoom15, so I’ll focus on the others I saw):

Sweeps now take in an FQuat for sweep rotation:



World->AsyncSweepByObjectType(EAsyncTraceType::Single, StartTransform.GetLocation(), EndTransform.GetLocation(), **FQuat::Identity,** ObjectQuery, Shape);


FAnimTickRecord swapped parameter order:



FAnimTickRecord& SequenceTickRecord = Proxy->CreateUninitializedTickRecord(SyncGroup, NAME_None); // Was previously (FName, SyncGroup)


Animation Sequences now take in a FAnimationPoseData struct when querying pose/curve data:

Previously:



AnimSequence->GetAnimationPose(Output.Pose, Output.Curve, FAnimExtractContext(OutputTime, Output.AnimInstanceProxy->ShouldExtractRootMotion()));


Now:



FAnimationPoseData PoseData(/*FPoseContext*/Output);
AnimSequence->GetAnimationPose(PoseData, FAnimExtractContext(OutputTime, Output.AnimInstanceProxy->ShouldExtractRootMotion()));


Getting an Animation Pose requires using a new structure and has a new data type called FStackCustomAttributes:

Previously:



FCompactPose Poses;
FBlendedCurve Curves;
float Weights = 0.0f;
AnimationSequence->GetAnimationPose(Poses, Curves, FAnimExtractContext(CurrentEntry.TimeAccumulator, Proxy->ShouldExtractRootMotion()));


Now:



FCompactPose Poses;
FBlendedCurve Curves;
FStackCustomAttributes Attribs;
float Weights = 0.0f;

FAnimationPoseData PoseA(Poses, Curves, Attribs);
AnimationSequence->GetAnimationPose(PoseA, FAnimExtractContext(CurrentEntry.TimeAccumulator, Proxy->ShouldExtractRootMotion()));


Likewise, BlendPosesTogether got updated:

Previously:



FAnimationRuntime::BlendPosesTogether(Poses, Curves, Weights, Output.Pose, Output.Curve);


Now:



FAnimationRuntime::BlendPosesTogether(Poses, Curves, Attribs, Weights, PoseData);


If you have a custom Animation Graph Node, they changed up how you add a sync group.
Previously:



UAnimBlueprint* AnimBlueprint = GetAnimBlueprint();
Node.GroupIndex = AnimBlueprint->FindOrAddGroup(SyncGroup.GroupName);
Node.GroupRole = SyncGroup.GroupRole;


Now:



UAnimBlueprint* AnimBlueprint = GetAnimBlueprint();
AnimBlueprint->FindOrAddGroup(SyncGroup.GroupName);
Node.GroupName = SyncGroup.GroupName;
Node.GroupScope = SyncGroup.GroupScope;
Node.GroupRole = SyncGroup.GroupRole;


They also added a new required virtual function called OnProcessDuringCompilation, but you can just pull that from of the other graph nodes - it’s pretty generic.

If you inherit from the FBlueprintEditor (or SCSEditor), the **CommonInitialization **got a new parameter added to it - you can read about what it does in the code.

Previously:



CommonInitialization(MyAsset);


Now:



CommonInitialization(MyAsset, false);


Probably a few others I’m forgetting, but obviously the Animation changes were what hit me the most.

3 Likes

Many core engine types (mostly physics ones) have, for some reason, been moved to ChaosPhysicsInterface.h and out of EngineTypes. This will result in quite a few linker errors possibly since that’s a different module, so you may need to include PhysicsCore as a dependency now. I was getting constant linker errors because of ERadialImpulseFalloff



PublicDependencyModuleNames.AddRange(new string] { "PhysicsCore" });



UDeveloperSettings also appears to have been moved to it’s own module, so you’ll need DeveloperSettings dependency too.



PublicDependencyModuleNames.AddRange(new string] { "DeveloperSettings" });



Here’s a fun one:

Calling IsInstanceSimulatingPhysics() on an FBodyInstance now required you to include the ‘PhysicsCore’ module too, because the function is inlined and calls a function from FBodyInstanceCore.

Looks like an oversight, as it produces very misleading linker errors.


HTTP Requests use Thread-Safe shared pointers now, so existing code needs to be updated also:



TSharedRef<IHttpRequest> NewRequest = FHttpModule::Get().CreateRequest();

becomes:
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> NewRequest = FHttpModule::Get().CreateRequest();


Base Delegate has changed too. Trying to pass a base delegate into an async task has changed from:



TBaseDelegate<ReturnType, ArgTypes...>


to:



TDelegate<ReturnType(ArgTypes...)>


Check this in Delegate.h line 500.

…and:



TBaseMulticastDelegate<ReturnType, ArgTypes...>


change to:



TMulticastDelegate<ReturnType(ArgTypes...)>


My findings so far… :slight_smile:

If you’re implementing a new Animation Node type, with the editor node extending the AnimGraphNode_AssetPlayerBase type, they’ve added an override for *OnProcessDuringCompilation *to that class which is not API exported, causing a linking failure.

I plan to file a bug report for this, solution in the meantime is to copy-paste the guts of that functions implementation into your overriding class, and NOT calling UAnimGraphNode_AssetPlayerBase::OnProcessDuringCompilation from your implementation.

1 Like

Any reference to the RHI will not work as it is now a separate module.

For example if you are using the GPixelFormats map to load textures at runtime, you will get:


error LNK2019: unresolved external symbol "__declspec(dllimport) struct FPixelFormatInfo * GPixelFormats"

Simply add RHI to the modules to solve


PublicDependencyModuleNames.AddRange(new string] { "RHI" });