You can’t, blueprint classes are generated at runtime so they are not known at compile time. Use TSubclassOf with the most-derived native parent class instead.
If your BPs extend actor or another very common class, you can make an intermediate c++ class inbetween Actor and the Bp class, just for the sake of filtering.
You can check at runtime if the supplied class is a blueprint class :
if (Cast<UBlueprintGeneratedClass>(In))
{
// is a blueprint class
}
You can even check if the supplied class is a subclass of a specific blueprint class, but that means hardcoding a string reference which is not recommended :
UClass* BpClassRef = FindObject<UClass>(nullptr, TEXT("/Game/Blueprints/MyBlueprint.MyBlueprint_C"));
if (BpClassRef && In && In->IsChildOf(BpClassRef))
{
// is a child class of BpClassRef
}
Your explanation is plausible to us. BP classes are not known at compile time.
We hoped to use the derived _C class somehow, for which you provided us the last code snippet. Thanks for that! Not ideal of course.
Mostly we wanted to use this, to be able to only input a subset of bp classes into a BP function.
Something like UObject → OurParentBPClass → OurChildBPClassXY
And only allow sub classes of OurParentBPClass.
I think this is not a common problem, or is resolved by defining those classes in C++ in the first place.