2019-12-26 15:33:43 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-05-22 12:00:20 -04:00
# pragma once
# include "CoreMinimal.h"
# include "UObject/ObjectMacros.h"
# include "Misc/Guid.h"
# include "AnimGraphNode_CustomProperty.h"
2021-05-24 06:55:32 -04:00
# include "EdGraphSchema_K2_Actions.h"
2020-09-01 14:07:48 -04:00
# include "IClassVariableCreator.h"
2021-05-24 06:55:32 -04:00
# include "K2Node_EventNodeInterface.h"
2019-05-22 12:00:20 -04:00
2019-09-23 07:23:26 -04:00
# include "AnimGraphNode_LinkedAnimGraphBase.generated.h"
2019-05-22 12:00:20 -04:00
class FCompilerResultsLog ;
class IDetailLayoutBuilder ;
class IPropertyHandle ;
class SToolTip ;
2019-09-23 07:23:26 -04:00
struct FAnimNode_LinkedAnimGraph ;
2019-05-22 12:00:20 -04:00
UCLASS ( MinimalAPI , Abstract )
2021-05-24 06:55:32 -04:00
class UAnimGraphNode_LinkedAnimGraphBase : public UAnimGraphNode_CustomProperty , public IK2Node_EventNodeInterface
2019-05-22 12:00:20 -04:00
{
GENERATED_BODY ( )
public :
//~ Begin UEdGraphNode Interface.
virtual FLinearColor GetNodeTitleColor ( ) const override ;
2021-05-24 06:55:32 -04:00
virtual FSlateIcon GetIconAndTint ( FLinearColor & OutColor ) const override ;
2019-05-22 12:00:20 -04:00
virtual FText GetTooltipText ( ) const override ;
2021-05-24 06:55:32 -04:00
virtual FText GetMenuCategory ( ) const override ;
2019-05-22 12:00:20 -04:00
virtual FText GetNodeTitle ( ENodeTitleType : : Type TitleType ) const override ;
virtual void ValidateAnimNodeDuringCompilation ( USkeleton * ForSkeleton , FCompilerResultsLog & MessageLog ) override ;
2021-11-07 23:43:01 -05:00
virtual void CreateOutputPins ( ) override ;
2019-05-22 12:00:20 -04:00
virtual void PostEditChangeProperty ( FPropertyChangedEvent & PropertyChangedEvent ) override ;
virtual void CustomizeDetails ( IDetailLayoutBuilder & DetailBuilder ) override ;
//~ End UEdGraphNode Interface.
// UAnimGraphNode_Base interface
virtual FPoseLinkMappingRecord GetLinkIDLocation ( const UScriptStruct * NodeType , UEdGraphPin * SourcePin ) override ;
2021-01-06 09:11:59 -04:00
virtual void GetOutputLinkAttributes ( FNodeAttributeArray & OutAttributes ) const override ;
virtual bool ShouldShowAttributesOnPins ( ) const override { return false ; }
2021-01-25 08:43:19 -04:00
virtual void OnCopyTermDefaultsToDefaultObject ( IAnimBlueprintCopyTermDefaultsContext & InCompilationContext , IAnimBlueprintNodeCopyTermDefaultsContext & InPerNodeContext , IAnimBlueprintGeneratedClassCompiledData & OutCompiledData ) override ;
2021-04-22 04:57:09 -04:00
virtual void GetRequiredExtensions ( TArray < TSubclassOf < UAnimBlueprintExtension > > & OutExtensions ) const override ;
2019-05-22 12:00:20 -04:00
// UAnimGraphNode_CustomProperty interface
2019-12-13 11:07:03 -05:00
virtual bool IsStructuralProperty ( FProperty * InProperty ) const override ;
2022-02-28 11:25:34 -05:00
virtual bool NeedsToSpecifyValidTargetClass ( ) const override { return false ; }
2019-05-22 12:00:20 -04:00
// Node accessor
2019-09-23 07:23:26 -04:00
virtual FAnimNode_LinkedAnimGraph * GetLinkedAnimGraphNode ( ) PURE_VIRTUAL ( UAnimGraphNode_LinkedAnimGraphBase : : GetLinkedAnimGraphNode , return nullptr ; ) ;
virtual const FAnimNode_LinkedAnimGraph * GetLinkedAnimGraphNode ( ) const PURE_VIRTUAL ( UAnimGraphNode_LinkedAnimGraphBase : : GetLinkedAnimGraphNode , return nullptr ; ) ;
2019-05-22 12:00:20 -04:00
2021-05-24 06:55:32 -04:00
// IK2Node_EventNodeInterface interface
virtual TSharedPtr < FEdGraphSchemaAction > GetEventNodeAction ( const FText & ActionCategory ) override ;
2019-05-22 12:00:20 -04:00
protected :
2021-04-22 04:57:09 -04:00
friend class UAnimBlueprintExtension_LinkedAnimGraph ;
2020-09-01 14:07:48 -04:00
// Called pre-compilation to allocate pose links
void AllocatePoseLinks ( ) ;
2019-09-23 07:23:26 -04:00
// Finds out whether there is a loop in the graph formed by linked instances from this node
2019-05-22 12:00:20 -04:00
bool HasInstanceLoop ( ) ;
2019-08-08 11:18:26 -04:00
2019-09-23 07:23:26 -04:00
/** Generates widgets for exposing/hiding Pins for this node using the provided detail builder */
2019-08-08 11:18:26 -04:00
void GenerateExposedPinsDetails ( IDetailLayoutBuilder & DetailBuilder ) ;
2019-05-22 12:00:20 -04:00
2019-09-23 07:23:26 -04:00
// Finds out whether there is a loop in the graph formed by linked instances from CurrNode, used by HasInstanceLoop. VisitedNodes and NodeStack are required
2019-05-22 12:00:20 -04:00
// to track the graph links
// VisitedNodes - Node we have searched the links of, so we don't do it twice
// NodeStack - The currently considered chain of nodes. If a loop is detected this will contain the chain that causes the loop
2019-09-23 07:23:26 -04:00
static bool HasInstanceLoop_Recursive ( UAnimGraphNode_LinkedAnimGraphBase * CurrNode , TArray < FGuid > & VisitedNodes , TArray < FGuid > & NodeStack ) ;
2019-05-22 12:00:20 -04:00
// ----- UI CALLBACKS ----- //
// Gets path to the currently selected instance class' blueprint
virtual FString GetCurrentInstanceBlueprintPath ( ) const ;
// Filter callback for blueprints (only accept matching skeletons/interfaces)
virtual bool OnShouldFilterInstanceBlueprint ( const FAssetData & AssetData ) const ;
// Instance blueprint was changed by user
void OnSetInstanceBlueprint ( const FAssetData & AssetData , IDetailLayoutBuilder * InDetailBuilder ) ;
// ----- END UI CALLBACKS ----- //
2021-05-24 06:55:32 -04:00
2022-03-10 21:02:48 -05:00
virtual FLinearColor GetDefaultNodeTitleColor ( ) const ;
2021-05-24 06:55:32 -04:00
// Skeleton name used for filtering unloaded classes
FString SkeletonName ;
2021-12-08 06:43:16 -05:00
// Template flag used for filtering unloaded classes
bool bIsTemplateAnimBlueprint = false ;
// Interface flag used for filtering unloaded classes
bool bIsInterfaceBlueprint = false ;
2019-05-22 12:00:20 -04:00
} ;
2019-09-23 07:23:26 -04:00
UE_DEPRECATED ( 4.24 , " UAnimGraphNode_SubInstanceBase has been renamed to UAnimGraphNode_LinkedAnimGraphBase " )
typedef UAnimGraphNode_LinkedAnimGraphBase UAnimGraphNode_SubInstanceBase ;