Unable to assign animation blueprint to skeletal mesh with C++ in 4.15

If I create a new project in UE 4.15, and create a c++ class that uses the following code to load an animation blueprint:

static ConstructorHelpers::FObjectFinder MeshBaseAnimRef(TEXT("/Game/ABP_AssetName"));
MeshBase->SetAnimInstanceClass(MeshBaseAnimRef.Object->GeneratedClass);

The code will not compile, saying that UAnimBlueprint is an ‘incomplete class type’. If I create a project in an earlier version, and add the same code, there will be no such error, and the project can be converted to 4.15 without a problem from there.

Cheers! (This question used to be an attempted bug report, and has been edited down to be more concise. Short answer: AnimBlueprint.h must be included manually now.)

-Ben

Hi Ben,

incomplete type usually means you’re missing an include, try to include “AnimBlueprint.h” where you need to use it.

Hey Sirennus-

When something has been deprecated, that means that it still works currently, but is in the process of being phased out / replaced. Without seeing the full compile error, Cø’s suggestion of specifically including AnimBlueprint would be my best guess to fix the issue. If adding the include does not fix the compile error, please provide the full error you receive to provide further information.

Cheers

UAnimBlueprint is declared in AnimBlueprint.h, not in SkeletalMeshComponent.h

No luck, tried including “Components/SkeletalMeshComponent.h”, which is where UAnimBlueprint is declared, with no change. I’ll put the UE message log in the ‘question’ post now.

Guess I don’t know how to navigate visual studio, cause it only led me there. Yes, that worked. So i guess this isn’t a bug, after all. Thanks for your help, guys. This is a better solution than the one that I found.
*edit:
Since there’s clearly no error on UE’s part here, should I remove this question to clear space? I think this goes to show that I should leave bug reports to the experts, heheh.
*Edit 2: Hang on, why DID this happen, anyway? Despite this resolution, this still leaves 4.15 unable to use UAnimBlueprint without an include, unlike the previous versions, isn’t that a problem?
-Ben

Hey Ben,

The removal of the include (from previous engine versions) was an intentional change made to improve overall compile times. This is why the include had to be added manually.

Oh dear, wish I had known that from the start :^)
Thanks again! I’ll leave this be, now.