#pragma once #include "CoreMinimal.h" #include "EdGraph/EdGraph.h" class UBlueprintNodeSpawner; struct FEdGraphSchemaAction; // Holds a collection of graph actions, populated from either the // BlueprintActionDatabase (for K2 graphs) or GetGraphContextActions // (for everything else). struct FWingGraphActions { public: // Constructor populates the list of actions. FWingGraphActions(UEdGraph* Graph, const FString& Query, int32 MaxResults = 0, bool ExactMatch=false); // Get the number of results. int Count() const { return Spawners.Num() + Actions.Num(); } // Get the name of the nth result. FString GetFullName(int32 N); // Execute the nth result, which should create a graph node. // If it can't, it will print an error and return nullptr. UEdGraphNode *Execute(int32 N, int32 PosX, int32 PosY); private: // The Graph that we're generating Actions for. UEdGraph *Graph; // One of these two will be populated, depending on graph type. TArray> Actions; TArray Spawners; // Get the full name of an action. FString GetFullName(const FEdGraphSchemaAction& Action); FString GetFullName(const UBlueprintNodeSpawner* Spawner); // Compare an action against a query. bool IsMatch(const FEdGraphSchemaAction& Action, const FString &QueryLower, bool Exact); bool IsMatch(const UBlueprintNodeSpawner* Spawner, const FString &QueryLower, bool Exact); // Execute an action UEdGraphNode* Execute(FEdGraphSchemaAction& Action, int32 X, int32 Y); UEdGraphNode* Execute(UBlueprintNodeSpawner* Spawner, int32 X, int32 Y); // Routines that collect actions and spawners. void CollectActions(UEdGraph* GraphP, const FString& Query, int32 MaxResults, bool ExactMatch); void CollectSpawners(UEdGraph* GraphP, const FString& Query, int32 MaxResults, bool ExactMatch); };