You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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]
160 lines
6.6 KiB
C++
160 lines
6.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Kismet2/BlueprintEditorUtils.h"
|
|
#include "Animation/InputScaleBias.h"
|
|
#include "AnimGraphNode_Base.h"
|
|
#include "ScopedTransaction.h"
|
|
#include "DetailLayoutBuilder.h"
|
|
|
|
// Helper struct used to handle graph (editor) node alpha options
|
|
struct FAnimGraphNodeAlphaOptions
|
|
{
|
|
// This assumes that a anim node contains the following members:
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
|
|
// float Alpha;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
// FInputScaleBias AlphaScaleBias;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (DisplayName = "Blend Settings"))
|
|
// FInputAlphaBoolBlend AlphaBoolBlend;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
|
|
// FName AlphaCurveName;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
// FInputScaleBiasClamp AlphaScaleBiasClamp;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
// EAnimAlphaInputType AlphaInputType;
|
|
//
|
|
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault, DisplayName = "bEnabled", DisplayAfter = "AlphaScaleBias"))
|
|
// bool bAlphaBoolEnabled;
|
|
//
|
|
// This is implemented in this way (rather than encapsulating the options in their own struct) because
|
|
// we dont support exposing pins from sub-structs on anim nodes (or anything else for that matter).
|
|
|
|
// Called from an UAnimGraphNode_Base-derived classes CustomizePinData to update alpha pins
|
|
template<typename AnimNodeType>
|
|
static void HandleCustomizePinData(const AnimNodeType& InAnimNode, UEdGraphPin* InPin)
|
|
{
|
|
if (InPin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, Alpha))
|
|
{
|
|
InPin->bHidden = (InAnimNode.AlphaInputType != EAnimAlphaInputType::Float);
|
|
|
|
if (!InPin->bHidden)
|
|
{
|
|
InPin->PinFriendlyName = InAnimNode.AlphaScaleBias.GetFriendlyName(InAnimNode.AlphaScaleBiasClamp.GetFriendlyName(InPin->PinFriendlyName));
|
|
}
|
|
}
|
|
|
|
if (InPin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, bAlphaBoolEnabled))
|
|
{
|
|
InPin->bHidden = (InAnimNode.AlphaInputType != EAnimAlphaInputType::Bool);
|
|
}
|
|
|
|
if (InPin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, AlphaCurveName))
|
|
{
|
|
InPin->bHidden = (InAnimNode.AlphaInputType != EAnimAlphaInputType::Curve);
|
|
|
|
if (!InPin->bHidden)
|
|
{
|
|
InPin->PinFriendlyName = InAnimNode.AlphaScaleBiasClamp.GetFriendlyName(InPin->PinFriendlyName);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Called from an UAnimGraphNode_Base-derived classes PostEditChangeProperty to update alpha properties and pins
|
|
template<typename AnimNodeType>
|
|
static void HandlePostEditChangeProperty(const AnimNodeType& InAnimNode, UAnimGraphNode_Base* InNode, FPropertyChangedEvent& PropertyChangedEvent)
|
|
{
|
|
const FName PropertyName = (PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None);
|
|
|
|
// Reconstruct node to show updates to PinFriendlyNames.
|
|
if ((PropertyName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, AlphaScaleBias))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, bMapRange))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputRange, Min))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputRange, Max))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, Scale))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, Bias))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, bClampResult))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, ClampMin))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, ClampMax))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, bInterpResult))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, InterpSpeedIncreasing))
|
|
|| (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FInputScaleBiasClamp, InterpSpeedDecreasing)))
|
|
{
|
|
InNode->ReconstructNode();
|
|
}
|
|
|
|
if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, AlphaInputType))
|
|
{
|
|
FScopedTransaction Transaction(NSLOCTEXT("AnimGraphNodeAlphaOptions", "ChangeAlphaInputType", "Change Alpha Input Type"));
|
|
InNode->Modify();
|
|
|
|
// Break links to pins going away
|
|
for (int32 PinIndex = 0; PinIndex < InNode->Pins.Num(); ++PinIndex)
|
|
{
|
|
UEdGraphPin* Pin = InNode->Pins[PinIndex];
|
|
if (Pin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, Alpha))
|
|
{
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Float)
|
|
{
|
|
Pin->BreakAllPinLinks();
|
|
}
|
|
}
|
|
else if (Pin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, bAlphaBoolEnabled))
|
|
{
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Bool)
|
|
{
|
|
Pin->BreakAllPinLinks();
|
|
}
|
|
}
|
|
else if (Pin->PinName == GET_MEMBER_NAME_STRING_CHECKED(AnimNodeType, AlphaCurveName))
|
|
{
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Curve)
|
|
{
|
|
Pin->BreakAllPinLinks();
|
|
}
|
|
}
|
|
}
|
|
|
|
InNode->ReconstructNode();
|
|
|
|
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(InNode->GetBlueprint());
|
|
}
|
|
}
|
|
|
|
// Called from an UAnimGraphNode_Base-derived classes CustomizeDetails to update alpha properties and pins
|
|
template<typename AnimNodeType>
|
|
static void HandleCustomizeDetails(const AnimNodeType& InAnimNode, TSharedRef<IPropertyHandle> InNodeHandle, IDetailLayoutBuilder& InDetailBuilder)
|
|
{
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Bool)
|
|
{
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, bAlphaBoolEnabled)));
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, AlphaBoolBlend)));
|
|
}
|
|
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Float)
|
|
{
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, Alpha)));
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, AlphaScaleBias)));
|
|
}
|
|
|
|
if (InAnimNode.AlphaInputType != EAnimAlphaInputType::Curve)
|
|
{
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, AlphaCurveName)));
|
|
}
|
|
|
|
if ((InAnimNode.AlphaInputType != EAnimAlphaInputType::Float)
|
|
&& (InAnimNode.AlphaInputType != EAnimAlphaInputType::Curve))
|
|
{
|
|
InDetailBuilder.HideProperty(InNodeHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(AnimNodeType, AlphaScaleBiasClamp)));
|
|
}
|
|
}
|
|
};
|