You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Adds 'template' anim BP concept. These anim BPs have no TargetSkeleton and as such cannot have direct references to animations placed inside of their anim graphs Adds function call support from anim nodes. All anim graph nodes can now call functions when initialized, updated, evaluated or when they first become relevant. Relevancy is established using a new FAnimSubsystemInstance_NodeRelevancy which tracks nodes in a local map, per UAnimInstance, if nodes require it. Functions are displayed on the node if bound, and in the details panel. Added a new override point to FAnimSubsystemInstance to allow for WT init. Moved FMemberReference customization into a public header so it can be used on anim node functions. Wrapped functions up into FAnimNodeFunctionRef structure so they can be re-used more effectively. Converted CallFunction node to use them. Added a couple of simple BP function libraries to demonstrate the use of the new FAnimNodeContext (this is intended to be a generic way of exposing FAnimNode_Base types to script without the node types themselves having to be known to script directly). Added the ability to set exposed properties as 'always dynamic' so they appear in mutable data rather than being merged into constants. This allows for the anim node data API to be changed to be less strict (and more script friendly). Now values can be set in mutable data (via GET_MUTABLE_ANIM_NODE_DATA_PTR) and attempted sets to constant data can be ignored and reported to client code. A few minor crash fixes with edge cases (inc when trying to open an asset editor fails because of a missing skeleton/cancellation). Also fixes an issue where literal linked anim graph/control rig/custom poroperty node inputs didnt get copied #rb Jurre.deBaare,Aaron.Cox [CL 16703644 by Thomas Sarkanen in ue5-main branch]
175 lines
7.2 KiB
C++
175 lines
7.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "IAnimBlueprintCompilationContext.h"
|
|
#include "IAnimBlueprintCompilationBracketContext.h"
|
|
#include "IAnimBlueprintCopyTermDefaultsContext.h"
|
|
#include "IAnimBlueprintPostExpansionStepContext.h"
|
|
#include "IAnimBlueprintNodeOverrideAssetsContext.h"
|
|
#include "Animation/AnimationAsset.h"
|
|
|
|
class FAnimBlueprintCompilerContext;
|
|
class UAnimBlueprintExtension;
|
|
struct FAnimNode_Base;
|
|
|
|
class FAnimBlueprintCompilationContext : public IAnimBlueprintCompilationContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
friend class IAnimBlueprintCompilationContext;
|
|
|
|
FAnimBlueprintCompilationContext(FAnimBlueprintCompilerContext* InCompilerContext)
|
|
: CompilerContext(InCompilerContext)
|
|
{}
|
|
|
|
virtual void AddPoseLinkMappingRecordImpl(const FPoseLinkMappingRecord& InRecord) override;
|
|
virtual void ProcessAnimationNodesImpl(TArray<UAnimGraphNode_Base*>& AnimNodeList) override;
|
|
virtual void PruneIsolatedAnimationNodesImpl(const TArray<UAnimGraphNode_Base*>& RootSet, TArray<UAnimGraphNode_Base*>& GraphNodes) override;
|
|
virtual void ExpansionStepImpl(UEdGraph* Graph, bool bAllowUbergraphExpansions) override;
|
|
virtual FCompilerResultsLog& GetMessageLogImpl() const override;
|
|
virtual bool ValidateGraphIsWellFormedImpl(UEdGraph* Graph) const override;
|
|
virtual int32 GetAllocationIndexOfNodeImpl(UAnimGraphNode_Base* VisualAnimNode) const override;
|
|
virtual const UBlueprint* GetBlueprintImpl() const override;
|
|
virtual const UAnimBlueprint* GetAnimBlueprintImpl() const override;
|
|
virtual UEdGraph* GetConsolidatedEventGraphImpl() const override;
|
|
virtual void GetLinkedAnimNodesImpl(UAnimGraphNode_Base* InGraphNode, TArray<UAnimGraphNode_Base*>& LinkedAnimNodes) const override;
|
|
virtual const TMap<UAnimGraphNode_Base*, int32>& GetAllocatedAnimNodeIndicesImpl() const override;
|
|
virtual const TMap<UAnimGraphNode_Base*, UAnimGraphNode_Base*>& GetSourceNodeToProcessedNodeMapImpl() const override;
|
|
virtual const TMap<int32, FProperty*>& GetAllocatedPropertiesByIndexImpl() const override;
|
|
virtual const TMap<UAnimGraphNode_Base*, FProperty*>& GetAllocatedPropertiesByNodeImpl() const override;
|
|
virtual void AddAttributesToNodeImpl(UAnimGraphNode_Base* InNode, TArrayView<const FName> InAttributes) const override;
|
|
virtual TArrayView<const FName> GetAttributesFromNodeImpl(UAnimGraphNode_Base* InNode) const override;
|
|
virtual bool IsAnimGraphNodeFoldedImpl(UAnimGraphNode_Base* InNode) const override;
|
|
virtual const IAnimBlueprintCompilationContext::FFoldedPropertyRecord* GetFoldedPropertyRecordImpl(UAnimGraphNode_Base* InNode, FName InPropertyName) const override;
|
|
virtual const FStructProperty* GetMutableDataPropertyImpl() const override;
|
|
virtual FKismetCompilerContext* GetKismetCompiler() const override;
|
|
|
|
FAnimBlueprintCompilerContext* CompilerContext;
|
|
};
|
|
|
|
class FAnimBlueprintCompilationBracketContext : public IAnimBlueprintCompilationBracketContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintCompilationBracketContext(FAnimBlueprintCompilerContext* InCompilerContext)
|
|
: CompilerContext(InCompilerContext)
|
|
{}
|
|
|
|
virtual FCompilerResultsLog& GetMessageLogImpl() const override;
|
|
virtual const TMap<UAnimGraphNode_Base*, int32>& GetAllocatedAnimNodeIndicesImpl() const override;
|
|
|
|
FAnimBlueprintCompilerContext* CompilerContext;
|
|
};
|
|
|
|
class FAnimBlueprintCopyTermDefaultsContext : public IAnimBlueprintCopyTermDefaultsContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintCopyTermDefaultsContext(FAnimBlueprintCompilerContext* InCompilerContext)
|
|
: CompilerContext(InCompilerContext)
|
|
{}
|
|
|
|
virtual FCompilerResultsLog& GetMessageLogImpl() const override;
|
|
virtual const UAnimBlueprint* GetAnimBlueprintImpl() const override;
|
|
|
|
FAnimBlueprintCompilerContext* CompilerContext;
|
|
};
|
|
|
|
class FAnimBlueprintNodeCopyTermDefaultsContext : public IAnimBlueprintNodeCopyTermDefaultsContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintNodeCopyTermDefaultsContext(UObject* InCDO, const FProperty* InTargetProperty, uint8* InDestinationPtr, const uint8* InSourcePtr, int32 InNodePropertyIndex)
|
|
: CDO(InCDO)
|
|
, TargetProperty(InTargetProperty)
|
|
, DestinationPtr(InDestinationPtr)
|
|
, SourcePtr(InSourcePtr)
|
|
, NodePropertyIndex(InNodePropertyIndex)
|
|
{}
|
|
|
|
virtual UObject* GetClassDefaultObjectImpl() const override { return CDO; }
|
|
virtual const FProperty* GetTargetPropertyImpl() const override { return TargetProperty; }
|
|
virtual uint8* GetDestinationPtrImpl() const override { return DestinationPtr; }
|
|
virtual const uint8* GetSourcePtrImpl() const override { return SourcePtr; }
|
|
virtual int32 GetNodePropertyIndexImpl() const override { return NodePropertyIndex; }
|
|
|
|
UObject* CDO;
|
|
const FProperty* TargetProperty;
|
|
uint8* DestinationPtr;
|
|
const uint8* SourcePtr;
|
|
int32 NodePropertyIndex;
|
|
};
|
|
|
|
class FAnimBlueprintExtensionCopyTermDefaultsContext : public IAnimBlueprintExtensionCopyTermDefaultsContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintExtensionCopyTermDefaultsContext(UObject* InCDO, const FProperty* InTargetProperty, uint8* InDestinationPtr, const uint8* InSourcePtr, int32 InNodePropertyIndex)
|
|
: CDO(InCDO)
|
|
, TargetProperty(InTargetProperty)
|
|
, DestinationPtr(InDestinationPtr)
|
|
, SourcePtr(InSourcePtr)
|
|
, NodePropertyIndex(InNodePropertyIndex)
|
|
{}
|
|
|
|
virtual UObject* GetClassDefaultObjectImpl() const override { return CDO; }
|
|
virtual const FProperty* GetTargetPropertyImpl() const override { return TargetProperty; }
|
|
virtual uint8* GetDestinationPtrImpl() const override { return DestinationPtr; }
|
|
virtual const uint8* GetSourcePtrImpl() const override { return SourcePtr; }
|
|
virtual int32 GetNodePropertyIndexImpl() const override { return NodePropertyIndex; }
|
|
|
|
UObject* CDO;
|
|
const FProperty* TargetProperty;
|
|
uint8* DestinationPtr;
|
|
const uint8* SourcePtr;
|
|
int32 NodePropertyIndex;
|
|
};
|
|
|
|
class FAnimBlueprintPostExpansionStepContext : public IAnimBlueprintPostExpansionStepContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintPostExpansionStepContext(FAnimBlueprintCompilerContext* InCompilerContext)
|
|
: CompilerContext(InCompilerContext)
|
|
{}
|
|
|
|
virtual FCompilerResultsLog& GetMessageLogImpl() const override;
|
|
virtual UEdGraph* GetConsolidatedEventGraphImpl() const override;
|
|
virtual const FKismetCompilerOptions& GetCompileOptionsImpl() const override;
|
|
|
|
FAnimBlueprintCompilerContext* CompilerContext;
|
|
};
|
|
|
|
class FAnimBlueprintNodeOverrideAssetsContext : public IAnimBlueprintNodeOverrideAssetsContext
|
|
{
|
|
private:
|
|
friend class FAnimBlueprintCompilerContext;
|
|
|
|
FAnimBlueprintNodeOverrideAssetsContext(FAnimNode_Base* InAnimNode, UScriptStruct* InAnimNodeType)
|
|
: AnimNode(InAnimNode)
|
|
, AnimNodeType(InAnimNodeType)
|
|
{}
|
|
|
|
// Add an asset to this context
|
|
void AddAsset(UObject* InAsset) { Assets.Add(InAsset); }
|
|
|
|
virtual FAnimNode_Base* GetAnimNodeImpl() const override { return AnimNode; }
|
|
virtual UScriptStruct* GetAnimNodeTypeImpl() const override { return AnimNodeType; }
|
|
virtual TArrayView<UObject* const> GetAssetsImpl() const override { return MakeArrayView(Assets); }
|
|
|
|
// The anim node we are targeting
|
|
FAnimNode_Base* AnimNode;
|
|
|
|
// The type of the anim node we are targeting
|
|
UScriptStruct* AnimNodeType;
|
|
|
|
// All the assets to override
|
|
TArray<UObject*> Assets;
|
|
}; |