GetOptions (meta)
Makes a FString input into a combo dropdown by defining a function to use to get the options. NOTE: The function has to be a UFUNCTION!
Example
(From SHADERSOURCE: Texture Tools)
class USH_TEX_Statics : public UBlueprintFunctionLibrary
{
UFUNCTION()
static TArray<FString> GetSamplerNames();
}
class USH_TEX_Job_AIGeneration : public USH_TEX_TextureJob
{
UPROPERTY(EditAnywhere, Category = "Sampler", meta = (GetOptions = "SH_TEX_Statics.GetSamplerNames"))
FString Sampler = "euler";
}

Note: If GetOptions is used in a struct and there is no leading class name (eg, "GetAIWorkFlows" rather than "USH_TEX_Job_AIGeneration.GetAIWorkFlows", the code will look up to the struct's parent recursively until it finds a UFUNCTION definition that matches its name. That way the GetOptions function does not have to be static, it can be an instance of an object.
struct FSH_TEX_AISettings_Workflow
{
/* Which ComfyUI workflow to use (drop down of all ComfyUI Workflows included in this plugin). */
UPROPERTY(EditAnywhere, Category = "Workflow", meta = (GetOptions = "GetAIWorkFlows"))
FString Workflow = SH_TEX::DefaultWorkflow;
};
class USH_TEX_Job_AIGeneration : public USH_TEX_TextureJob
{
UPROPERTY(EditAnywhere, Category = "Workflow")
FSH_TEX_AISettings_Workflow WorkflowSettings = FSH_TEX_AISettings_Workflow();
UFUNCTION(BlueprintPure, Category = "AI Job")
TArray<FString> GetAIWorkFlows();
}
Reference
Last updated