Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Public/AnimGraphNode_LinkedAnimLayer.h
thomas sarkanen df0b8f03c8 Fixed linked anim layers showing up multiple times in context menu
Iterate over interfaces rather than ALL anim BPs, as well as accounting for self layers, then filter appropriately according to current BP

#jira UE-133258 - Linked anim layers show up multiple times in the context menu
#rb Jurre.deBaare
#preflight 61e56fa4a2616066f68089e5

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 18632528 in //UE5/Release-5.0/... via CL 18632536 via CL 18632539
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18636706 by thomas sarkanen in ue5-main branch]
2022-01-18 00:02:46 -05:00

104 lines
4.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Misc/Guid.h"
#include "AnimGraphNode_LinkedAnimGraphBase.h"
#include "Animation/AnimNode_LinkedAnimLayer.h"
#include "AnimGraphNode_LinkedAnimLayer.generated.h"
class FCompilerResultsLog;
class IDetailLayoutBuilder;
class IPropertyHandle;
class SToolTip;
UCLASS(MinimalAPI)
class UAnimGraphNode_LinkedAnimLayer : public UAnimGraphNode_LinkedAnimGraphBase
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = Settings)
FAnimNode_LinkedAnimLayer Node;
/** Guid of the named layer graph we refer to */
UPROPERTY()
FGuid InterfaceGuid;
// Begin UObject interface
virtual void Serialize(FArchive& Ar) override;
//~ Begin UEdGraphNode Interface.
virtual FText GetTooltipText() const override;
virtual FSlateIcon GetIconAndTint(FLinearColor& OutColor) const override;
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual void ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog) override;
virtual UObject* GetJumpTargetForDoubleClick() const override;
virtual void JumpToDefinition() const override;
virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput /*= NULL*/) const override;
virtual void ReconstructNode() override;
//~ End UEdGraphNode Interface.
// UK2Node interface
virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const override;
virtual bool IsActionFilteredOut(class FBlueprintActionFilter const& Filter) override;
// UAnimGraphNode_Base interface
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
// Optionally updates layer GUID if it is invalid
void UpdateGuidForLayer();
protected:
// ----- UI CALLBACKS ----- //
// Handlers for layer combo
void GetLayerNames(TArray<TSharedPtr<FString>>& OutStrings, TArray<TSharedPtr<SToolTip>>& OutToolTips, TArray<bool>& OutRestrictedItems);
FString GetLayerName() const;
void OnLayerChanged(IDetailLayoutBuilder* DetailBuilder);
bool HasAvailableLayers() const;
bool HasValidNonSelfLayer() const;
void HandleSetObjectBeingDebugged(UObject* InDebugObj);
void HandleInstanceChanged();
// ----- END UI CALLBACKS ----- //
// UAnimGraphNode_Base interface
virtual FProperty* GetPinProperty(FName InPinName) const override;
virtual void CreateCustomPins(TArray<UEdGraphPin*>* OldPins) override;
// Begin UAnimGraphNode_CustomProperty
virtual FAnimNode_CustomProperty* GetCustomPropertyNode() override { return &Node; }
virtual const FAnimNode_CustomProperty* GetCustomPropertyNode() const override { return &Node; }
virtual bool NeedsToSpecifyValidTargetClass() const override { return false; }
virtual UClass* GetTargetSkeletonClass() const override;
// Begin UAnimGraphNode_LinkedAnimGraphBase
virtual FAnimNode_LinkedAnimLayer* GetLinkedAnimGraphNode() override { return &Node; }
virtual const FAnimNode_LinkedAnimLayer* GetLinkedAnimGraphNode() const override { return &Node; }
virtual bool OnShouldFilterInstanceBlueprint(const FAssetData& AssetData) const override;
virtual FString GetCurrentInstanceBlueprintPath() const override;
virtual bool IsStructuralProperty(FProperty* InProperty) const override;
friend class FAnimationLayerDragDropAction;
// Helper function to get the interface currently in use by the selected layer
TSubclassOf<UInterface> GetInterfaceForLayer() const;
// Helper function to get the interface graph GUID currently in use by the selected layer
FGuid GetGuidForLayer() const;
// Get the preview node, if any, when instanced in an animation blueprint and debugged
FAnimNode_LinkedAnimLayer* GetPreviewNode() const;
// Helper function to setup a newly spawned node
void SetupFromLayerId(FName InLayerId);
// Handle used to hook into object being debugged changing
FDelegateHandle SetObjectBeingDebuggedHandle;
};
UE_DEPRECATED(4.24, "UAnimGraphNode_Layer has been renamed to UAnimGraphNode_LinkedAnimLayer")
typedef UAnimGraphNode_LinkedAnimLayer UAnimGraphNode_Layer;