You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Added the abiity to tag and retrieve any anim graph node (similar to how we could reference linked anim graph nodes previously). Ported linked anim graph nodes to use the new system Added the ability to reference any anim graph node by tag (via a new custom node, spawnable from the context menu, with the appearance of an actor reference in a level blueprint) Added tag display and editing in the bottom-right of anim graph nodes Added new override point to SGraphNodeK2Var to allow for title widget parameters to be overriden by child classes #jira UE-126286 - Anim node functions: Add anim node references #rb Jurre.deBaare #ROBOMERGE-AUTHOR: thomas.sarkanen #ROBOMERGE-SOURCE: CL 17472894 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530) [CL 17472913 by thomas sarkanen in ue5-release-engine-test branch]
89 lines
2.7 KiB
C++
89 lines
2.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AnimationNodes/SGraphNodeBlendSpacePlayer.h"
|
|
#include "SBlendSpacePreview.h"
|
|
#include "AnimGraphNode_Base.h"
|
|
#include "AnimGraphNode_BlendSpacePlayer.h"
|
|
#include "Kismet2/BlueprintEditorUtils.h"
|
|
#include "SLevelOfDetailBranchNode.h"
|
|
#include "Widgets/Layout/SSpacer.h"
|
|
|
|
void SGraphNodeBlendSpacePlayer::Construct(const FArguments& InArgs, UAnimGraphNode_Base* InNode)
|
|
{
|
|
this->GraphNode = InNode;
|
|
|
|
this->SetCursor(EMouseCursor::CardinalCross);
|
|
|
|
this->UpdateGraphNode();
|
|
|
|
CachedSyncGroupName = NAME_None;
|
|
|
|
SAnimationGraphNode::Construct(SAnimationGraphNode::FArguments(), InNode);
|
|
|
|
RegisterActiveTimer(1.0f / 60.0f, FWidgetActiveTimerDelegate::CreateLambda([this](double InCurrentTime, float InDeltaTime)
|
|
{
|
|
UpdateGraphSyncLabel();
|
|
return EActiveTimerReturnType::Continue;
|
|
}));
|
|
}
|
|
|
|
void SGraphNodeBlendSpacePlayer::CreateBelowPinControls(TSharedPtr<SVerticalBox> MainBox)
|
|
{
|
|
SAnimationGraphNode::CreateBelowPinControls(MainBox);
|
|
|
|
// Insert above the error reporting bar (but above the tag/functions)
|
|
MainBox->InsertSlot(FMath::Max(0, MainBox->NumSlots() - DebugGridSlotReverseIndex))
|
|
.AutoHeight()
|
|
.VAlign(VAlign_Fill)
|
|
.Padding(0.0f)
|
|
[
|
|
SNew(SLevelOfDetailBranchNode)
|
|
.UseLowDetailSlot(this, &SGraphNodeBlendSpacePlayer::UseLowDetailNodeTitles)
|
|
.LowDetail()
|
|
[
|
|
SNew(SSpacer)
|
|
.Size(FVector2D(100.0f, 100.f))
|
|
]
|
|
.HighDetail()
|
|
[
|
|
SNew(SBlendSpacePreview, CastChecked<UAnimGraphNode_Base>(GraphNode))
|
|
]
|
|
];
|
|
}
|
|
|
|
void SGraphNodeBlendSpacePlayer::UpdateGraphSyncLabel()
|
|
{
|
|
if (UAnimGraphNode_BlendSpacePlayer* VisualBlendSpacePlayer = Cast<UAnimGraphNode_BlendSpacePlayer>(GraphNode))
|
|
{
|
|
FName CurrentSyncGroupName = NAME_None;
|
|
|
|
if (UAnimBlueprint* AnimBlueprint = Cast<UAnimBlueprint>(FBlueprintEditorUtils::FindBlueprintForNode(GraphNode)))
|
|
{
|
|
if(UAnimBlueprintGeneratedClass* GeneratedClass = AnimBlueprint->GetAnimBlueprintGeneratedClass())
|
|
{
|
|
if (UObject* ActiveObject = AnimBlueprint->GetObjectBeingDebugged())
|
|
{
|
|
if(VisualBlendSpacePlayer->Node.GetGroupMethod() == EAnimSyncMethod::Graph)
|
|
{
|
|
int32 NodeIndex = GeneratedClass->GetNodeIndexFromGuid(VisualBlendSpacePlayer->NodeGuid);
|
|
if(NodeIndex != INDEX_NONE)
|
|
{
|
|
if(const FName* SyncGroupNamePtr = GeneratedClass->GetAnimBlueprintDebugData().NodeSyncsThisFrame.Find(NodeIndex))
|
|
{
|
|
CurrentSyncGroupName = *SyncGroupNamePtr;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(CachedSyncGroupName != CurrentSyncGroupName)
|
|
{
|
|
// Invalidate the node title so we can dynamically display the sync group gleaned from the graph
|
|
VisualBlendSpacePlayer->OnNodeTitleChangedEvent().Broadcast();
|
|
CachedSyncGroupName = CurrentSyncGroupName;
|
|
}
|
|
}
|
|
}
|