// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "RigVMNode.h" #include "RigVMGraphSection.generated.h" #define UE_API RIGVMDEVELOPER_API class URigVMGraph; USTRUCT() struct FRigVMGraphSectionLink { GENERATED_BODY() UPROPERTY() int32 SourceNodeIndex = INDEX_NONE; UPROPERTY() int32 TargetNodeIndex = INDEX_NONE; UPROPERTY() uint32 SourceNodeHash = UINT32_MAX; UPROPERTY() uint32 TargetNodeHash = UINT32_MAX; UPROPERTY() FString SourcePinPath; UPROPERTY() FString TargetPinPath; using FPinTuple = TTuple; static URigVMPin* FindSourcePinSkippingReroutes(const URigVMLink* InLink); static TArray FindTargetPinsSkippingReroutes(const URigVMLink* InLink); static TArray FindLinksSkippingReroutes(const URigVMNode* InNode); const URigVMNode* FindSourceNode(const URigVMNode* InTargetNode) const; TArray FindTargetNodes(const URigVMNode* InSourceNode) const; }; USTRUCT() struct FRigVMGraphSection { GENERATED_BODY() public: UE_API FRigVMGraphSection(); UE_API FRigVMGraphSection(const TArray& InNodes); UE_API static TArray GetSectionsFromSelection(const URigVMGraph* InGraph); UE_API bool IsValid() const; UE_API static bool IsValidNode(const URigVMNode* InNode); UPROPERTY() uint32 Hash; UPROPERTY() TArray Nodes; UPROPERTY() TArray NodeHashes; UPROPERTY() TArray LeafNodes; UPROPERTY() TArray Links; UE_API TArray FindMatches(const URigVMGraph* InGraph) const; UE_API TArray FindMatches(const TArray& InAvailableNodes) const; UE_API bool ContainsNode(const FName& InNodeName) const; UE_API bool MatchesNode(const URigVMNode* InNode, const TArray& InAvailableNodes, TArray* OutMatchingNodesForSet = nullptr) const; private: void Reset(); static TArray> GetNodeIslands(const TArray& InNodes); static uint32 GetNodeHash(const URigVMNode* InNode); static uint32 GetLinkHash(const FRigVMGraphSectionLink& InLink); bool MatchesNode_Impl(const URigVMNode* InNode, const TArray& InAvailableNodes, int32 InNodeIndex, TArray& VisitedNodes) const; friend struct FRigVMGraphSectionLink; }; #undef UE_API