Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Public/AnimGraphNode_LinkedInputPose.h
Thomas Sarkanen 5419497f90 BlendSpace 2.0: Blendspace Graph Node
Added a new animation graph node that hosts its own UBlendSpaceBase. Modified UBlendSpaceBase to allow for pose links to be evaluated as the sample points.
The new blend space graphs can be spawned from existing UBlendSpace and UBlendSpace1D assets, or they can be created from scratch, or they can be converted from existing blendspace player nodes via the context menu.

Fixed anim node conversion functions so that their transactions work correctly.

Updated FBlueprintEditorUtils::IsGraphNameUnique to allow it to work with any object as the outer, not just UBlueprint. UBlueprint still has a special case for functions and events. This is to support GenerateUniqueGraphName within a scope (e.g. an outer graph).

Formalized the concept of 'node sub-graphs' (as well as the composite node pattern a little). Previously a number of known node types that contained sub-graphs (e.g. UK2Node_Composite) had special case logic for dealing with node/graph deletion etc. Now  any node can opt into this behaviour via the GetSubGraphs() override.

Added status bar readouts for the blendspace grid, so we dont have to stuff the prompts into the tooltip any more.

Moved anim BP related APIs out of FBlueprintEditor. They are always used via FAnimationBlueprintEditor.

Refactored graph title bar widget creation out into a function to allow other document tab factories to create it.

Altered breadcrumb trail click callbacks and SMyBlueprint::ExecuteAction to always JumpToHyperLink rather than calling OpenDocument directly. This allows unknown (to FBlueprintEditor) document types that reference objects to be correctly jumped to using the breadcrumb trail. Derived asset editors (i.e. FAnimationBlueprintEditor) can intercept the JumpToHyperlink call to ensure that the correct document is presented (i.e. the correct tab payload is generated).

Instead of making yet another bunch of duplicated code for handling the various alpha blend options, refactored this into FAnimGraphNodeAlphaOptions (for editor code) and FAnimNodeAlphaOptions (for runtime code).

Added OnCopyTermDefaultsToDefaultObject for per-node copying of default values from editor node to runtime node, rather than another special-case in the compiler.

#rb Jurre.deBaare,Phillip.Kavan

[CL 15177316 by Thomas Sarkanen in ue5-main branch]
2021-01-25 08:43:19 -04:00

130 lines
4.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "AnimGraphNode_Base.h"
#include "Animation/AnimNode_LinkedInputPose.h"
#include "Engine/MemberReference.h"
#include "IClassVariableCreator.h"
#include "AnimGraphNode_LinkedInputPose.generated.h"
class SEditableTextBox;
/** Required info for reconstructing a manually specified pin */
USTRUCT()
struct FAnimBlueprintFunctionPinInfo
{
GENERATED_BODY()
FAnimBlueprintFunctionPinInfo()
: Name(NAME_None)
{
Type.ResetToDefaults();
}
FAnimBlueprintFunctionPinInfo(const FName& InName, const FEdGraphPinType& InType)
: Name(InName)
, Type(InType)
{
}
/** The name of this parameter */
UPROPERTY(EditAnywhere, Category = "Inputs")
FName Name;
/** The type of this parameter */
UPROPERTY(EditAnywhere, Category = "Inputs")
FEdGraphPinType Type;
};
UCLASS()
class ANIMGRAPH_API UAnimGraphNode_LinkedInputPose : public UAnimGraphNode_Base, public IClassVariableCreator
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = "Inputs")
FAnimNode_LinkedInputPose Node;
UPROPERTY(EditAnywhere, Category = "Inputs")
TArray<FAnimBlueprintFunctionPinInfo> Inputs;
/** Reference to the stub function we use to build our parameters */
UPROPERTY()
FMemberReference FunctionReference;
/** The index of the input pose, used alongside FunctionReference to build parameters */
UPROPERTY()
int32 InputPoseIndex;
UAnimGraphNode_LinkedInputPose();
/** UObject interface */
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
/** IClassVariableCreator interface */
virtual void CreateClassVariablesFromBlueprint(IAnimBlueprintVariableCreationContext& InCreationContext) override;
/** UEdGraphNode interface */
virtual FLinearColor GetNodeTitleColor() const override;
virtual FText GetTooltipText() const override;
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual bool CanUserDeleteNode() const override;
virtual bool CanDuplicateNode() const override;
virtual void AllocateDefaultPins() override;
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
virtual void PostPlacedNewNode() override;
virtual bool IsCompatibleWithGraph(UEdGraph const* Graph) const override;
/** UK2Node interface */
virtual bool HasExternalDependencies(TArray<UStruct*>* OptionalOutput) const override;
virtual void ExpandNode(class FKismetCompilerContext& InCompilerContext, UEdGraph* InSourceGraph) override;
/** UAnimGraphNode_Base interface */
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
virtual void GetOutputLinkAttributes(FNodeAttributeArray& OutAttributes) const override;
virtual bool ShouldShowAttributesOnPins() const override { return false; }
virtual void OnCopyTermDefaultsToDefaultObject(IAnimBlueprintCopyTermDefaultsContext& InCompilationContext, IAnimBlueprintNodeCopyTermDefaultsContext& InPerNodeContext, IAnimBlueprintGeneratedClassCompiledData& OutCompiledData) override;
/** Make a name widget for this linked input pose node */
TSharedRef<SWidget> MakeNameWidget(IDetailLayoutBuilder& DetailBuilder);
/** @return whether this node is editable. Non-editable nodes are implemented from function interfaces */
bool IsEditable() const { return CanUserDeleteNode(); }
/** @return the number of parameter inputs this node provides. This is either determined via the Inputs array or via the FunctionReference. */
int32 GetNumInputs() const;
/** Promotes the node from being a part of an interface override to a full function that allows for parameter and result pin additions */
void PromoteFromInterfaceOverride();
/** Conform input pose name according to function */
void ConformInputPoseName();
/** Validate pose index against the function reference (used to determine whether we should exist or not) */
bool ValidateAgainstFunctionReference() const;
/** Helper function for iterating stub function parameters */
void IterateFunctionParameters(TFunctionRef<void(const FName&, const FEdGraphPinType&)> InFunc) const;
private:
// Helper function for common code in AllocateDefaultPins and ReallocatePinsDuringReconstruction
void AllocatePinsInternal();
/** Create pins from the user-defined Inputs array */
void CreateUserDefinedPins();
/** Create pins from the stub function FunctionReference */
void CreatePinsFromStubFunction(const UFunction* Function);
private:
/** UI helper functions */
void HandleInputPoseArrayChanged();
void HandleInputPinArrayChanged();
};
UE_DEPRECATED(4.24, "UAnimGraphNode_SubInput has been renamed to UAnimGraphNode_LinkedInputPose")
typedef UAnimGraphNode_LinkedInputPose UAnimGraphNode_SubInput;