Currently we can use TSubclassOf<MyClass> to get class type of any class that is MyClass or inherits from it.
One can easily add DisallowedClasses to metadata and use it on the asset picker to filter. It’s even done when picking assets, just not classes.
Common use case people have is they want to disallow MyClass it self (only children).
Personally, I also need to disallow for a few more classes
To do this, one should:
(1) SPropertyEditorClass.cpp: class FPropertyEditorClassFilter. Add TArray<UClass*> DisallowClasses,and check them on the 2 methods in there.
(2) SPropertyEditorClass.cpp: GenerateClassPicker() method. Get the property (or outer if it’s array), and get metadata from it. then parse it to a list of TArray<UClass*> and pass it to filter.
(2) May sounds a bit complicated, and I didn’t elaborate much on it, but it can be easily copied (or move code to another single place and use it in both places) from:
SPropertyEditorAsset.cpp, SPropertyEditorAsset::Construct(), line 164 on 4.21.1
p.s.
I’m afraid my computer doesn’t have the capacity to have an build the entire editor source, and hence why I’m putting it here.
But if anyone has it and can make a pull request, that would be awesome too!