C++ Transition Guide for 4.22

hi
ive been trying to update this plugin
https://forums.unrealengine.com/community/community-content-tools-and-tutorials/60077-the-re-inventing-the-wheel-thread

i have this error, TestCar is the name of the plugin.


Severity Code Description Project File Line Suppression State 
 Error    LNK2001    unresolved external symbol IMPLEMENT_MODULE_TestCar    CarPluginProject    J:\UE4Projects\CarPluginProject 4.22\Intermediate\ProjectFiles\LINK    1

what has changed since 4.20 that would cause an error like this? thanks

@tegleg see an earlier post (just take care that the IMPLEMENT_MODULE refers to the Folder name)

thanks for the reply

for those struggling with this in the future i had to change


IMPLEMENT_MODULE(TestCarImp, Module)

to


IMPLEMENT_MODULE(TestCarImpl, TestCar)

thanks again @Domonic.BW

I upgraded my project from 4.20 to 4.22 but i have problems. It compiles fine in visual studio… says it compiles fine in ue4 with a small hickup…“LogVSAccessor: Warning: Couldn’t access Visual Studio” is a warning message in the output log…

Then if i try to run my project for testing purposes via the command prompt of windows… it says "the following modules are missing or built with a different engine version… etc… would you like to rebuild them now? "

This always fails. Why would this be happening?

Have you cleaned and recompiled the project completley ? What VS compiler version do you use ? 2015 is not supported anymore.

Thank you so much!

This worked in 4.20. It no longer works correctly in 4.22.

The issue is that when making a higher resolution image than the current display resolution the current display image is no longer being rendered at the requested resolution. Instead you get an image of the correct resolution but the image from the viewport is a small portion of the image, specifically it ends up in the upper left corner.

Any help would be greatly appreciated.

James McKenzie
DragonClaw Studios

Here is the code that I used:


FString UTWS_FunctionLibrary::TWS_ScreenShot(UObject* WorldContextObject, const FString& InFileName, bool bInShowUI, bool bUniqueName, bool bHighRes, int32 ResolutionX, int32 ResolutionY)
{
FString FileNameToUse = InFileName;
FString FileName, Path, Extention;
int counter = 0;

if (FileNameToUse.IsEmpty())
FileNameToUse = “screenshot.png”;

if (FileNameToUse.Contains("…")) return TEXT("");

FPaths::Split(FileNameToUse, Path, FileName, Extention);
Path = FPaths::ProjectSavedDir() + “ScreenShots” + Path;

FileNameToUse = Path + “/” + FileName + “.” + Extention;

while(bUniqueName && FPaths::FileExists(FileNameToUse) && counter < 1000) {
FileNameToUse = Path + “/” + FileName + FString(std::to_string(++counter).c_str()) + “.” + Extention;
}

GIsHighResScreenshot = bHighRes;

if (bHighRes) {
GScreenshotResolutionX = (uint32)ResolutionX; GScreenshotResolutionY = (uint32)ResolutionY;
}

UGameViewportClient* ViewportClient = WorldContextObject->GetWorld()->GetGameViewport();
ViewportClient->OnScreenshotCaptured().Clear();

//can’t use filePath as a function parameter, therefore need to ‘capture’ it (Capturing an object by name makes a lambda-local copy of the object.)
ViewportClient->OnScreenshotCaptured().AddLambda(
[FileNameToUse](int32 SizeX, int32 SizeY, const TArray<FColor>& Bitmap)
{
// Make sure that all alpha values are opaque.
TArray<FColor>& RefBitmap = const_cast<TArray<FColor>&>(Bitmap);
for (auto& Color : RefBitmap)
Color.A = 255;

TArray<uint8> CompressedBitmap;
FImageUtils::CompressImageArray(SizeX, SizeY, RefBitmap, CompressedBitmap);
//FString ScreenshotFilePath = GetScreenshotFilePath(CleanSlotFileName);
FFileHelper::SaveArrayToFile(CompressedBitmap, *FileNameToUse);
});

FScreenshotRequest::RequestScreenshot(InFileName, bInShowUI, bUniqueName);

if (bHighRes)
WorldContextObject->GetWorld()->GetGameViewport()->Viewport->TakeHighResScreenShot();

return FileNameToUse;
}


Hi,
old post but still undocumented, luckily from engine source the solution can be found:

FArchiveSaveCompressedProxy Compressor = FArchiveSaveCompressedProxy(CompressedData, NAME_Zlib, ECompressionFlags::COMPRESS_ZLIB);

1 Like