Sorry for the delay, but I have all the details now.
Since “contexts” in engine-supplied tests and generators are just classes rather than class instances there’s no way to currently get direct blackboards support.
However, here’s what can be done. Classes in UE4 can be marked so that when required they’ll be created and edited “in line”, just add a EditInlineNew
keyword to UCLASS
definition (adding collapseCategories
won’t hurt neither). To take advantage of this functionality one needs to add an UPROPERTY
of that class, marked as Instanced
.
So, in our case UEnvQueryContext
needs to be marked as EditInlineNew
and tests or generators that would want to take advantage of that need to declare their context as
UPROPERTY(EditDefaultsOnly, Instanced, Category = "YourDreamCategoryName")
UEnvQueryContext* AnyContext;
Then we could declare a Blackboard-based context, something like following:
UCLASS()
class AIMODULE_API UEnvQueryContext_Blackboard : public UEnvQueryContext
{
GENERATED_BODY()
protected:
UPROPERTY(EditAnywhere, meta = (EditCondition = "bBlackboardAssetSet"), Category = "EQS")
FBlackboardKeySelector BlackboardKey;
UPROPERTY(EditAnywhere, Category = "EQS")
UBlackboardData* Blackboard;
UPROPERTY(EditAnywhere, meta=(EditCondition="!bBlackboardAssetSet"), Category = "EQS")
FName KeyName;
UPROPERTY()
bool bBlackboardAssetSet;
public:
UEnvQueryContext_Blackboard(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void ProvideContext(FEnvQueryInstance& QueryInstance, FEnvQueryContextData& ContextData) const override;
};
This is of course very limiting, because you can only use it for your own tests/generators, or you’d need to modify engine sources to update all the supplied tests. But if you really need this kind of functionality that’s how you can get it. On the bright side I think it’s a great idea so we’ll switch over to using class instances for contexts in the future, but I can’t promise any ETA.
Hope it helps.