Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"



ゲーム中に写真を取って保存したいです。 参考になるサイトを探して、ココ(https://answers.unrealengine.com/questions/333254/how-can-i-save-a-rendertarget-or-a-texture-to-a-fi.html)にのっているものが使えそうだと感じました。これをBPのノードとして作り、使いたいです。BPのノードをC++で作る方法はここ(http://unrealengine.hatenablog.com/entry/2014/09/10/202645)を参考にしてやればできると思い、やってみたのですが、エラーが出ました。 UE4とC++は始めたばかりで、具体的にどうやったらエラーが解決できるのかわかりません。



// .h

 #pragma once
 #include "CoreMinimal.h"
 #include "Kismet/BlueprintFunctionLibrary.h"
 class GAMESYSTEM_1_API USaveTarget : public UBlueprintFunctionLibrary
         UFUNCTION(BlueprintCallable, Category = "MyBPLibrary")
         static void SaveRenderTargetToDisk(UTextureRenderTarget2D* InRenderTarget, FString Filename);


 #include "SaveTarget.h"
 #include "HighResScreenshot.h"
 #include "TextureResource.h"
 #include "TextureRender"
 void SaveRenderTargetToDisk(UTextureRenderTarget2D* InRenderTarget, FString Filename)
     FTextureRenderTargetResource* RTResource = InRenderTarget -> GameThread_GetRenderTargetResource();
     FReadSurfaceDataFlags ReadPixelFlags(RCM_UNorm);
     TArray<FColor> OutBMP;
     RTResource->ReadPixels(OutBMP, ReadPixelFlags);
     for (FColor& color : OutBMP)
         color.A = 255;
     FIntRect SourceRect;
     FIntPoint DestSize(InRenderTarget->GetSurfaceWidth(), InRenderTarget->GetSurfaceHeight());
     FString ResultPath;
     FHighResScreenshotConfig& HighResScreenshotConfig = GetHighResScreenshotConfig();
     HighResScreenshotConfig.SaveImage(Filename, OutBMP, DestSize, &ResultPath);

エラー No #include found for the .generated.h file - the .generated.h file should always be the last #include in a header GameSystem_1 D:\UE4_projects\GameSystem_1\Intermediate\ProjectFiles\LogCompile 1
エラー Expected an include at the top of the header: '#include "SaveTarget.generated.h"' GameSystem_1 D:\UE4_projects\GameSystem_1\Source\GameSystem_1\SaveTarget.h 24
エラー UnrealHeaderTool failed for target 'GameSystem_1Editor' (platform: Win64, module info: D:\UE4_projects\GameSystem_1\Intermediate\Build\Win64\GameSystem_1Editor\Development\GameSystem_1Editor.uhtmanifest, exit code: OtherCompilationError (5)). GameSystem_1 D:\UE4_projects\GameSystem_1\Intermediate\ProjectFiles\EXEC 1
エラー MSB3075 コマンド ""C:\Program Files\Epic Games\UE_4.17\Engine\Build\BatchFiles\Build.bat" GameSystem_1Editor Win64 Development "D:\UE4_projects\GameSystem_1\GameSystem_1.uproject" -waitmutex" はコード 5 で終了しました。このコマンドを実行するための十分な権限があるか確認してください。 GameSystem_1 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 41

Product Version: UE 4.17
more ▼

asked Oct 07 '17 at 08:33 AM in C++ Programming

avatar image

1 1 1

avatar image takeru4055 Oct 11 '17 at 04:40 PM


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question