x

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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

2D animation ConstructorStatics error

Hello everyone

I'm having a trouble setting 2D flipbook animation into C++, this problem wasn't there in the past. I used to do this method without any problems but now when I do header:

     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FlipbookComponent", meta = (AllowPrivateAccess = "true"))
         class UPaperFlipbookComponent * paperComponent;
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FlipbookComponent", meta = (AllowPrivateAccess = "true"))
         class UPaperFlipbook* paperSoPWalk;

Cpp: struct FConstructorStatics { ConstructorHelpers::FObjectFinderOptional paperSoPWalkAsset;

     FConstructorStatics()
         : paperSoPWalkAsset(TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"))
     {
     }
 };
 static FConstructorStatics ConstructorStatics;
 paperSoPWalk = ConstructorStatics.paperSoPWalkAsset.Get();

gives me bugs apparely the problem coming from this line paperSoPWalk = ConstructorStatics.paperSoPWalkAsset.Get();

alt text

Product Version: UE 4.15
Tags:
cpp.jpg (272.4 kB)
more ▼

asked Dec 13 '17 at 02:23 PM in C++ Programming

avatar image

DiverFictionB
13 1 2 3

(comments are locked)
10|2000 characters needed characters left

5 answers: sort voted first

Make sure you include "Paper2D" module and include "PaperFlipbook.h".

more ▼

answered Dec 14 '17 at 11:38 PM

avatar image

xlar8or
6k 160 128 304

(comments are locked)
10|2000 characters needed characters left

It's a compiler error so you need to check the syntax, usually what i do is:

 static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnObject(TEXT("/Game/Characters/Scavenger/Player_BP.Player_BP_C"));
 
     if (PlayerPawnObject.Object)
         DefaultPawnClass = PlayerPawnObject.Object;

So in your case you can try:

     static ConstructorHelpers::FObjectFinder<UPaperFlipbook> PaperFlipbookObject(TEXT("/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation")); // If this doesnt work try with "/Game/2DSideScroller/Sprites/RunningAnimation"
     
         if (PaperFlipbookObject.Object)
             Class = PaperFlipbookObject.Object;


more ▼

answered Dec 13 '17 at 03:43 PM

avatar image

xlar8or
6k 160 128 304

(comments are locked)
10|2000 characters needed characters left

Hi, thank you for your response

It didn't work alt text

question.jpg (195.5 kB)
more ▼

answered Dec 13 '17 at 07:14 PM

avatar image

DiverFictionB
13 1 2 3

avatar image xlar8or Dec 13 '17 at 09:36 PM

The screenshot doesn't help, disable the warnings and show only the errors.

(comments are locked)
10|2000 characters needed characters left

these are the errors three of them

**Severity Code Description Project File Line Suppression State Error C2664 'void ConstructorHelpers::ValidateObject(UObject ,const FString &,const TCHAR )': cannot convert argument 1 from 'UPaperFlipbook ' to 'UObject *' ManSide3 E:\Program Files\Epic Games\UE_4.18\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h 109
Severity Code Description Project File Line Suppression State Error Failed to produce item: E:\users\diverfictionb\documents\repos\ManSide3\Binaries\Win64\UE4Editor-ManSide3-1164.dll ManSide3 E:\users\diverfictionb\documents\repos\ManSide3\Intermediate\ProjectFiles\ERROR 1

Severity Code Description Project File Line Suppression State Error MSB3075 The command ""E:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\Build.bat" ManSide3Editor Win64 Development "E:\users\diverfictionb\documents\repos\ManSide3\ManSide3.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command. ManSide3 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 41***

And the previous code that I used and the one that you suggested me to try:

 Cpp:
     struct FConstructorStatics
     {
           ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunningAnimAsset;
     FConstructorStatics()
         : RunningAnimAsset(TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"))
         {
         }
     };
     static FConstructorStatics ConstructorStatics; 
     RunningAnim = ConstructorStatics.RunningAnimAsset.Get();
 
 
 Cpp:
         static ConstructorHelpers::FObjectFinder<UPaperFlipbook> PaperFlipbookObject
         (TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"));
 
     if (PaperFlipbookObject.Object)
         Class = PaperFlipbookObject.Object;
 
 
 




more ▼

answered Dec 14 '17 at 01:59 AM

avatar image

DiverFictionB
13 1 2 3

avatar image xlar8or Dec 14 '17 at 10:26 AM

Have you included the PaperFlipbook header and added the Paper2D Module?

https://answers.unrealengine.com/questions/150461/paper-2d-c-cannot-open-source-papercharactergenera.html

(comments are locked)
10|2000 characters needed characters left

I thought "PaperFlipbookComponent.h" was enough, like the previous versions of UE4. I never thought the missing "PaperFlipbook.h" could be the problem. Thank you so much man, I have been trying to solve this problem for days :).

more ▼

answered Dec 14 '17 at 09:19 PM

avatar image

DiverFictionB
13 1 2 3

avatar image xlar8or Dec 14 '17 at 11:02 PM

Good to know, if it worked and you liked my help please upvote and mark my answer as correct :)

avatar image xlar8or Dec 14 '17 at 11:37 PM

I meant my answer :D I'll create one so you can mark it as correct.

avatar image DiverFictionB Dec 15 '17 at 12:41 AM

Sorry, I'm new to this site :). still learning

avatar image xlar8or Dec 15 '17 at 12:42 AM

No problem :)

(comments are locked)
10|2000 characters needed characters left
Your answer
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